I am trying to determine what issues could be caused by using the following serialization surrogate to enable serialization of anonymous functions/delegate/lambdas.
Some objects need execute arbitrary "events" reaching some condition.
Just how arbitrary are these events? Can they be counted, assigned ID's and mapped to referentially?
public class Command where T : ISerializable
{
T _target;
int _actionId;
int _conditionId;
public Command(T Target, int ActionId, int ConditionId)
{
_target = Target;
_actionId = ActionId;
_conditionId = ConditionId;
}
public bool FireRule()
{
Func theCondition = conditionMap.LookupCondition(_conditionId)
Action theAction = actionMap.LookupAction(_actionId);
if (theCondition(_target))
{
theAction(_target);
return true;
}
return false;
}
}