This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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