Is there a difference between these two formats for subscribing to events:
Style 1:
foo.BarEvent += FooEventMethod;
Style 2:
foo.BarEvent += new FooEventHandler(FooEventMethod);
This is c# 1.0 style of subscribing an event.
Starting from c# 2.0 you're allowed to subscribe event like this
above code is exactly equal to version1 code, what happens is compiler will create new FooEventHandler(FooEventMethod) in background for you.
new FooEventHandler(FooEventMethod)
1.4m articles
1.4m replys
5 comments
57.0k users