What is a differenece when we call a method by a Delegate or when we call a method by a making a class object using simple approach.
What is the advanges of these two when we use these approach with example
Loading
What is a differenece when we call a method by a Delegate or when we call a method by a making a class object using simple approach.
What is the advanges of these two when we use these approach with example
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Nov 6, 2013, 9:07 AM
The disadvantage of delegates is that an indirect call is slower than a direct call and needs more code.
The main advantages are that:
1 . More than one method can be called via a single delegate invocation.
2. A delegate enables method pointers to be passed to other methods so they can be called back from there.
3. Delegates are the basis of events in .NET.
The following simple example illustrates these points: