.Net - What is a delegate? Explain how to create
it. - June 03, 2009 at 11:00 AM by Shuchi Gauri
What is a delegate? Explain how to create it.
A delegate declares a ref type that references a named of anonymous method.
Delegates are secure and type-safe. Consider them as type safe function
pointers.
public delegate void Del<T>(T item);
Del<int> d1 = new Del<int>(Notify);
Also read
Here is an implementation of a very simple delegate that accepts no
parameters.................
The delegates in .NET are like the pointers to the functions in C/C++. The
difference is that these are type safe unlike the once in
C/C++.................
The difference between Factory and Abstract Factory Patterns lies in object
instantiation. In Abstract factory pattern Composition is used to delegate
object instantiation by a class to some object................
What is an Event?
Define Delegate.
What is the purpose of AddHandler keyword?...............
When a derived class is inherited from an Abstract class, no other class can be
extended then. Interface can be used in any scenario.................
|