本文整理汇总了C#中ExpressionGenerator.WithType方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionGenerator.WithType方法的具体用法?C# ExpressionGenerator.WithType怎么用?C# ExpressionGenerator.WithType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionGenerator
的用法示例。
在下文中一共展示了ExpressionGenerator.WithType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test001
public void Test001()
{
var xgr = new ExpressionGenerator();
var expr = Expression.Default(typeof(string));
var expr2 = xgr.WithType<string>(expr);
var expr3 = xgr.WithoutType(expr2);
var xcr = new ExpressionComparer();
Assert.IsTrue(xcr.AreEqual(expr, expr3));
}
示例2: Test003
public void Test003()
{
var xgr = new ExpressionGenerator();
var xc = new ExpressionComparer();
var e2 = xgr.WithType<int>(Expression.Default(typeof(int)));
var e3 = xgr.WithType<int>(Expression.Default(typeof(int)));
var e1 = xgr.MakeEqualityComparison(e2, e3);
var expected = Expression.Lambda<Func<bool>>(
Expression.MakeBinary(
ExpressionType.Equal,
Expression.Default(typeof(int)),
Expression.Default(typeof(int))
)
);
Assert.IsTrue(xc.AreEqual(expected, e1));
}
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:20,代码来源:ExpressionGenerator.MakeBinary.Tests.cs
示例3: Test093
public void Test093()
{
var xgr = new ExpressionGenerator();
var xc = new ExpressionComparer();
var e2 = xgr.WithType<bool>(Expression.Default(typeof(bool)));
var e3 = xgr.WithType<bool>(Expression.Default(typeof(bool)));
var e1 = xgr.MakeOrElse(e2, e3);
var expected = Expression.MakeBinary(
ExpressionType.OrElse,
Expression.Default(typeof(bool)),
Expression.Default(typeof(bool))
);
Assert.IsTrue(xc.AreEqual(expected, e1));
}
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:18,代码来源:ExpressionGenerator.MakeBinary.Tests.cs
示例4: Test082
public void Test082()
{
var xgr = new ExpressionGenerator();
var xc = new ExpressionComparer();
var e2 = xgr.WithType<bool?>(Expression.Default(typeof(bool?)));
var e3 = xgr.WithType<bool>(Expression.Default(typeof(bool)));
var e1 = xgr.MakeAndAlso(e2, e3);
var expected = Expression.MakeBinary(
ExpressionType.AndAlso,
Expression.Default(typeof(bool?)),
Expression.Convert(Expression.Default(typeof(bool)), typeof(bool?))
);
Assert.IsTrue(xc.AreEqual(expected, e1));
}
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:18,代码来源:ExpressionGenerator.MakeBinary.Tests.cs
示例5: Test073
public void Test073()
{
var xgr = new ExpressionGenerator();
var xc = new ExpressionComparer();
var e2 = xgr.WithType<int>(Expression.Default(typeof(int)));
var e3 = xgr.WithType<int>(Expression.Default(typeof(int)));
var e1 = xgr.MakeBinary(e2, ExpressionType.Add, e3);
var expected = Expression.MakeBinary(
ExpressionType.Add,
Expression.Default(typeof(int)),
Expression.Default(typeof(int))
);
Assert.IsTrue(xc.AreEqual(expected, e1));
}
开发者ID:hannasm,项目名称:ExpressiveExpressionTreesDotNet,代码行数:18,代码来源:ExpressionGenerator.MakeBinary.Tests.cs
示例6: Test039
public void Test039()
{
var xgr = new ExpressionGenerator();
var e2 = Expression.Default(typeof(bool));
var e3 = Expression.Default(typeof(bool));
var e4 = Expression.Default(typeof(bool));
var e5 = Expression.Default(typeof(bool));
var e1 = xgr.WithType<bool>(Expression.Or(e2, Expression.And(Expression.Or(e3, e4), e5)));
var result = xgr.Split(e1, ExpressionType.And, ExpressionType.Or);
Assert.AreEqual(4, result.Length);
Assert.AreEqual(e2, result[0]);
Assert.AreEqual(e3, result[1]);
Assert.AreEqual(e4, result[2]);
Assert.AreEqual(e5, result[3]);
}
示例7: Test032
public void Test032()
{
var xgr = new ExpressionGenerator();
var e2 = Expression.Default(typeof(bool));
var e3 = Expression.Default(typeof(bool));
var e1 = xgr.WithType<bool>(Expression.Or(e2, e3));
var result = xgr.Split(e1, ExpressionType.And, ExpressionType.Or);
Assert.AreEqual(2, result.Length);
Assert.AreEqual(e2, result[0]);
Assert.AreEqual(e3, result[1]);
}
示例8: Test014
public void Test014()
{
var xgr = new ExpressionGenerator();
var e2 = Expression.Default(typeof(bool));
var e3 = Expression.Default(typeof(bool));
var e4 = Expression.Default(typeof(bool));
var e1 = xgr.WithType<bool>(Expression.And(Expression.And(e2, e3), e4));
var result = xgr.Split(e1, ExpressionType.And);
Assert.AreEqual(3, result.Length);
Assert.AreEqual(e2, result[0]);
Assert.AreEqual(e3, result[1]);
Assert.AreEqual(e4, result[2]);
}