Probably something simple I overlooked how do I fix this?
Note: compiler generates 0 errors yet it doesn’t build
/**
* The action (optional object[] is the params)
*/
private Action<object[]> action;
/**
* Parameters
*/
private object[] parameters;
public virtual void runAction() //<- this is overridable
{
action(parameters);
}
public void setAction(Action action)
{
this.action<null> = action<null>;
}
public void setAction(Action action, params object[] parameters)
{
this.parameters = this.parameters;
this.action<parameters> = action<parameters>;
}
Maybe there is a way I can make this even without object[] parameters even..
I call runAction outside this class. there are many classes like this in List all I call runAction method. I generate these classes on demend. This class contains a bunch more logic then just what you see.
Let me know thanks I appreciate the support.
This is a mess.
actionisn’t a generic type or generic method, so this isn’t supplying a generic parameter (and anyway, generic parameters are types, not variables. You’re actually somehow using the less-than and greater-than relational operators? Butparameters > ;doesn’t compare anything.The compiler is absolutely right not to let this build. It seems like this would be what you want:
I recommend that you read about “closures”. You might find that this class you’re writing isn’t very useful at all.