public static void AsTypeExpr() { ExpressionTrees.Test((Func <object, MyClass>)((object obj) => obj as MyClass), (Expression <Func <object, MyClass> >)((object obj) => obj as MyClass)); ExpressionTrees.Test((Func <object, GenericClass <object> >)((object obj) => obj as GenericClass <object>), (Expression <Func <object, GenericClass <object> > >)((object obj) => obj as GenericClass <object>)); }
public void NewMultiDimArray() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new int[3, 4].Length == 1); }
public void Quoted() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => (Expression <Func <int, string, string> >)((int n, string s) => s + n.ToString()) != null); }
private bool MyEquals(ExpressionTrees other) { throw new NotImplementedException(); }
public void MultipleDots() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => 3.ToString().ToString().Length > 0); }
public void LiteralCharAndProperty() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new string(' ', 3).Length == 1); }
public void NotImplicitCast() { byte z = 42; ExpressionTrees.ToCode(ExpressionTrees.X(), () => ~z == 0); }
public static void Capturing() { int captured = 5; ExpressionTrees.Test((Func <int>)(() => captured), (Expression <Func <int> >)(() => captured)); }
public static void Quote() { ExpressionTrees.Test((Func <bool>)(() => (Expression <Func <int, string, string> >)((int n, string s) => s + n.ToString()) != null), (Expression <Func <bool> >)(() => (Expression <Func <int, string, string> >)((int n, string s) => s + n.ToString()) != null)); }
public static void UnaryArithmeticOperators() { ExpressionTrees.Test((Func <int, int>)((int a) => a), (Expression <Func <int, int> >)((int a) => a)); ExpressionTrees.Test((Func <int, int>)((int a) => - a), (Expression <Func <int, int> >)((int a) => - a)); }
public static void SimpleExpressions() { ExpressionTrees.Test((Func <int>)(() => 0), (Expression <Func <int> >)(() => 0)); ExpressionTrees.Test((Func <int, int>)((int a) => a), (Expression <Func <int, int> >)((int a) => a)); }
public static void ConditionalOperator() { ExpressionTrees.ToCode(null, (bool a) => a ? 5 : 10); ExpressionTrees.ToCode(null, (object a) => a ?? new MyClass()); }
public static void UnaryLogicalOperators() { ExpressionTrees.Test((Func <bool, bool>)((bool a) => !a), (Expression <Func <bool, bool> >)((bool a) => !a)); }
public static void IsTypeExpr() { ExpressionTrees.Test((Func <object, bool>)((object obj) => obj is MyClass), (Expression <Func <object, bool> >)((object obj) => obj is MyClass)); }
public void IndexerAccess() { Dictionary <string, int> dict = Enumerable.Range(1, 20).ToDictionary((int n) => n.ToString()); ExpressionTrees.ToCode(ExpressionTrees.X(), () => dict["3"] == 3); }
public void Parameter(bool a) { ExpressionTrees.ToCode(ExpressionTrees.X(), () => a); }
public void IsOperator() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new object() is string); }
public void LocalVariable() { bool a = true; ExpressionTrees.ToCode(ExpressionTrees.X(), () => a); }
public void CharNoCast() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => "abc"[1] == 'b'); }
public void LambdaParameter() { ExpressionTrees.ToCode(ExpressionTrees.X(), (bool a) => a); }
public void DoAssert() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => this.field != this.C()); ExpressionTrees.ToCode(ExpressionTrees.X(), () => !object.ReferenceEquals(this, new ExpressionTrees())); ExpressionTrees.ToCode(ExpressionTrees.X(), () => this.MyEquals(this) && !this.MyEquals(null)); }
public void AddOperator(int x) { ExpressionTrees.ToCode(ExpressionTrees.X(), () => 1 + x + 2); }
public void MultipleCasts() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => 1 == (int)(object)1); }
public void ComplexGenericName() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => ((Func <int, bool>)((int x) => x > 0))(0)); }
public void CurriedLambda() { ExpressionTrees.ToCode(ExpressionTrees.X(), (Expression <Func <int, Func <int, Func <int, int> > > >)((int a) => (int b) => (int c) => a + b + c)); }
public void DefaultValue() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new TimeSpan(1, 2, 3) == default(TimeSpan)); }
public void NewObject() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new object() != new object()); }
public void EnumConstant() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => new object().Equals(MidpointRounding.ToEven)); }
public void Quoted2() { ExpressionTrees.ToCode(ExpressionTrees.X(), () => ExpressionTrees.ToCode(ExpressionTrees.X(), () => true).Equals(null)); }
public static void ArrayLength() { ExpressionTrees.Test((Func <int[], int>)((int[] array) => array.Length), (Expression <Func <int[], int> >)((int[] array) => array.Length)); ExpressionTrees.Test((Func <int>)(() => ((Array)null).Length), (Expression <Func <int> >)(() => ((Array)null).Length)); }