Main Content

Create Delegates from .NET Object Methods

The following C# class defines the methods AddEggs and AddFlour, which have signatures matching the delInteger delegate:

 C# Recipe Source File

Build the Recipe assembly, and then load it and create a delegate myFunc using AddEggs as the callback:

myRec = Recipe.MyClass;
myFunc = NetDocDelegate.delInteger(@myRec.AddEggs);
ans = 
Add 2 eggs

Related Examples

More About