C# Frequently Asked Questions

The C# team posts answers to common questions

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]

Published Friday, March 12, 2004 2:29 AM by CSharpFAQ

Comments

 

Daniel O'Connell said:

Only by making it non-virtual.
June 9, 2004 9:30 PM
Anonymous comments are disabled

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker