|
Step 1. Main enters to open a console
|
Step 1: B
|
Ste 2: Objectes are created after instances.
|
step 3:
|
Step 4: enter a string
|
step 4B:
|
Step 4C
|
Step 5
|
Step 6: Process through returns the value to a local method
to process. If you note the gray color of ec.processthough, means that the
circle of process through checks out the local
|
Step 7: The local process in turn checks back to
process_through.
|
step 8 returning
|
Step :9 now note "ep.process_through" completes the circle
of series of processes.
|
Step 10:
|
|
Some illustration
|
program flow
|
using System;
using System.Collections.Generic;
namespace test1
{
public
delegate
int
_DEH(deh
e);
class
test
{
static
void Main(string[]
args)
{
EP ep =
new
EP();
deh MyArgs
= new
deh();
Console.Write("Enter
a string ");
string str
=Console.ReadLine();
MyArgs.MyString = str;
ep.MyEvent += new
_DEH(main_process);
ep.process_through(MyArgs);
Console.ReadLine();
}
static
int
main_process(deh
e)
{
Console.WriteLine(e.MyString);
return 0;
}
}
public
class
deh :
EventArgs
{
//EventArgs is the base class for
classes containing event data.
//the application must derive a
class from this class to hold the data.
public
string
MyString;
}
public
class
EP
{
public
event
_DEH MyEvent;
public
int
process_through(deh
e)
{
MyEvent(e);
return 0;
}
}
}
|