I have
new List<string> {"MyTypeA", "MyTypeB"};
How can i generate types at runtime?
public class MyTypeA {decimal value {get;set;}};
public class MyTypeB; {decimal value {get;set;}};
Let me explain why I need this. Here, I wrote about the serialization of an expression-tree. In the end I used for this task Serialize.Linq. Serialization and deserialization works fine but I was faced with another problem. My algorithm builds an expression with the following body:
{(args[0] - args[1] + args[0])}
This body is obtained for the expression (MyTypeA - MyTypeB + MyTypeA), where MyTypeA and MyTypeB it is parameters. args[n] it is array of parameters. Problem is that I don't know association between array elements and arguments. If I am not mistaken, I should have something similar to this:
{(MyTypeA - MyTypeB + MyTypeA)}
Where MyTypeA & MyTypeB are runtime generated types. I know that's possible to write a wrapper and send expression and array with parameters at one time. But in my situation i can send expression on server today and parameters a week later. So I ask this question.
Here a Source code.
Functionality in which I doubt:
public Expression<Func<decimal[], decimal>> Parse()
method read expression string by characters.
private Expression ReadParameter(TextReader reader, Expression arrayParameter)
Creates an Expression that represents applying an array index operator.