public void AddFunction(Func <int> funcInt) { FunctionToCall functionToCall = new FunctionToCall(); functionToCall.ReturnType = ReturnType.Int; functionToCall.FuncInt = funcInt; functionToCall.Name = funcInt.Method.Name; _listFunctionToCall.Add(functionToCall); }
public void AddFunction(Func <bool> funcBool) { FunctionToCall functionToCall = new FunctionToCall(); functionToCall.ReturnType = ReturnType.Bool; functionToCall.FuncBool = funcBool; functionToCall.Name = funcBool.Method.Name; _listFunctionToCall.Add(functionToCall); }
public int ExecFunc(string functionName, int param1) { FunctionToCall functionToCall = _listFunctionToCall.Where(f => f.Name.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (functionToCall == null) { return(0); } return(functionToCall.FuncIntRetInt.Invoke(param1)); }
public bool ExecFunc(string functionName) { FunctionToCall functionToCall = _listFunctionToCall.Where(f => f.Name.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); if (functionToCall == null) { return(false); } return(functionToCall.FuncBool.Invoke()); }