What do I use instead of addressof?
To create delegate instances in C#, you just specify the delegate type, the method, and (if
you want to create a delegate targetting a different instance or type from the current one) the target.
For instance, each of these creates a ThreadStart delegate:
ThreadStart x1 = new ThreadStart(SomeInstanceMethod);
ThreadStart x2 = new ThreadStart(AnotherType.SomeStaticMethod);
ThreadStart x3 = new ThreadStart(someVariable.SomeInstanceMethod);
[Author: Jon Skeet]
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using