What do I use instead of addressof?

What do I use instead of addressof?

  • Comments 1

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]

Leave a Comment
  • Please add 5 and 6 and type the answer here:
  • Post
Page 1 of 1 (1 items)