I am currently using .NET 4 with Visual Studio 2010. MSDN said that Task.Delay
is not available in this version of .NET framework.
However, in my system ILdasm shows Task.Delay
do exists in mscorlib (4.0.0.0). So I tested using reflection:
typeof (Task).GetMethod("Delay", new []{typeof (int)})
.Invoke(null, new object[]{1000});
This seems to works on my computer. So my questions are:
Is this means Microsoft provided that method somehow, but they are just hiding it?
Is it safe to have a wrapper function to use it in above way? More precisely, would this work on other computers that only have .NET 4 installed? (my system is Windows 7)
UPDATE
I forgotten weather or not I had .NET 4.5 installed. So I checked from control panel. Yes, there is .NET 4.5.1 installed.