|
-
May 10th, 2004, 05:25 AM
#1
Thread Starter
Lively Member
Actual advantage of Delegates ??
Below is a valid example of a very simple Delegate.
Invocation is done at the line:
sd();
My Question is that whatever happens by calling "sd();"
can also be achieved by calling the "ActualFunction();"
Then WHY are we calling the other way round ??
using System;
namespace SimpleDelegateExample
{
delegate void SimpleDelegate();
class TestDelegate
{
static void ActualFunction()
{
Console.WriteLine("called by delegate..");
}
static void Main1()
{
SimpleDelegate sd = new SimpleDelegate(ActualFunction);
sd();
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|