Daniel Fisher (lennybacon.com)

SOA, DATA & THE WEB

.NET 2.0 Only 99.9% backwards compatible?

While re-writing a few WebServices for .NET 2.0 i ran across following:

...
public static void WaitProc(object state, bool timedOut)
{
   MyAsyncResult myAsyncResult = (MyAsyncResult)state;
   myAsyncResult.OriginalCallback.Invoke(myAsyncResult);
}
...

This compiles without any problems in Visual Studio .NET 2003 but makes the compiler scream (Invoke cannot be called directly on a delegate) untill you change the lines to the following:

...
public static void WaitProc(object state, bool timedOut)
{
   MyAsyncResult myAsyncResult = (MyAsyncResult)state;
   myAsyncResult.OriginalCallback(myAsyncResult);
}
...

Comments

Write a comment