The requirements are:
1. The anonymous delegate must be able to incapsulate parameters, like the Action<> object.
2. The anonymous delegate must be able to have a return type like: string returnValue = actionMethod.Invoke();
Example of the concept:
public void CallRetrieveDataFunction()
{
IRandomInterface classMain = new ClassMain();
Action
object response = RetrieveData(invokeMethod, classMain);
}
public object RetrieveData(Action
{
object returnValue;
returnValue = methodToExecute.Invoke(U);
return returnValue;
}
Anybody have any ideas?
ali veliPosted Apr 16, 2008, 11:01 AM
youtubeline
AlanPosted Apr 16, 2008, 9:51 AM
If you have .NET 3.5 (VS 2008), check out the Func generic delegate:
http://msdn2.microsoft.com/en-us/library/bb549151.aspx
There are also some overloads which can deal with up to four parameters.