|
using System.Linq.Expressions;
namespace TinyLisp {
// simple class that represents an int in an ExpressionTree
class IntNode : CodeNode {
// the value
public int Value { get; set; }
// constructor
public IntNode(char Value) {
char[] c = { Value };
this.Value = int.Parse(new string(c));
}
// Text used for it to display in the TreeView
public override string Text {
get { return Value.ToString(); }
}
// convert to Linq Expression
public override Expression ToExpression() {
// easy, it's a constant with a value
return Expression.Constant(Value);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Gert-Jan is a Senior Quantitative Risk Manager at Leaseplan Corporation. In that job he doesn't get to code much he does these little projects to keep his skills up and feed the inner geek.