What do I use instead of addressof?

Published 12 March 04 02:29 AM

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 RSS

Comments

# Daniel O'Connell said on June 9, 2004 9:30 PM:
Only by making it non-virtual.

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

This Blog

Syndication

Page view tracker