Delegates Mapping with Instance and Static Method

Delegate is very powerful concept in C# Programming world and I am sure everyone know that delegate takes methods as parameter only when method signature and its return type while declaration must be same as delegate.Before Anonymous Method feature ,only way to instantiate delegate using Named Method,at least now you have some basic idea about what is delegate since this article's scope is explore one of the delegates feature so without wasting reader's time ,will show one beauty of delegates that will hold instance method as well as static method.

Here I have created one Console application and proving using below snapshot:


Created ClassA contains instance & static method,


Above class methods are used using delegate,


Output as:



So using delegate, we can associate instance and static method under same delegate instance.
Ebook Download
View all
Learn
View all