1
Vote

Error in Delegate creation.

description

In C# the following should be equivalent --

MyDelegateType d = objRef.MthName;
MyDelegateType d = new MyDelegateType(objRef.MthName);

the second of these gets a "can't find name" error message.
Sometimes the second form must be used, as when one delegate wraps another --

public delegate void D1(int i);
public delegate void D2(int i);
...
D1 d1 = SomeMethod;
D2 d2 = new D2(d1);

file attachments

comments