tags:

views:

522

answers:

2

I came across this code today

AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null);

Is there anything wrong with it or no?

+2  A: 

it probably needs the cast to resolve overloads

Jimmy
+8  A: 

Sometimes, you need to to this when the method is overloaded... to tell the compiler which one you are calling. A null object is still null and it is safe.

Brian Genisio
Why didn't I check here before making a fool out of me on IRC?
PRINCESS FLUFF