vendredi 3 avril 2015

How to Invoke Method with parameters from text

I am trying to develop a template engine in c# and in my concept I will need to read to read methods as well as parameters from text files.This shows something could be done , but it does not work if the parameter is also read from the text.Is there a way to achieve this?



private static void Main(string[] args)
{
var stringFunction="AMethod(\"Hello\")";
string returnValue = Execute(stringFunction);
//the result in retunValue is same as from code commented below:
// string returnValue= AMethod("Hello");
}

public static string AMethod(string parameter)
{
return "xyz" + parameter;
}





Aucun commentaire:

Enregistrer un commentaire