I'm trying to assign a method (function) to an ExpandoObject with this signature:
public List<string> CreateList(string input1, out bool processingStatus)
{
//method code...
}
I've tried to do something like this code below which doesn't compile:
dynamic runtimeListMaker = new ExpandoObject();
runtimeListMaker.CreateList =
new Func<string, bool, List<string>>(
(input1, out processingStatus) =>
{
var newList = new List<string>();
//processing code...
processingStatus = true;
return newList;
});
Unfortunately I cannot change the CreateList signature because it will break backward compatibility so rewriting it is not an option. I've tried to get around this by using delegates but at runtime, I got an "Cannot invoke a non-delegate type" exception. I guess this means I'm not assigning the delegate correctly. I need help getting the syntax correct (delegate examples are OK too). Thanks!!