This is a Sample according to publisher-subscriber scenario in Observer design pattern which will give you the idea of creating and using the custom delegate - which is the same concept .Net for Function pointer
On publisher side:
Delegate:
public void delegate MyDelegate(MyType sender, MyParamCollection params);
Event in MyType:
public event MyDelegate MyEvent;
define some method for raising event like,
private void OnMyEvent() {
MyParamCollection coll = new MyParamCollection();
:
:
if(MyEvent !=null) {
MyEvent(this, coll);
}
}
and call this method at some point where you want to raise the specific event,
On subscriber side:
objMyType.MyEvent += new MyDelegate(MyEventHandlerMethod);
I think it's delegate. I copied this from .NET framework SDK Doc
The delegate keyword is used to declare a reference type that can be used to encapsulate a named or an anonymous method. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure
function ptr
ParkSys
On publisher side:
Event in MyType:
and call this method at some point where you want to raise the specific event,
HTH,
Rajavanya
The delegate keyword is used to declare a reference type that can be used to encapsulate a named or an anonymous method. Delegates are similar to function pointers in C++; however, delegates are type-safe and secure
and Event in .NET utilize this delegate things
check this
http://www.codeproject.com/csharp/delegates-part1.asp