本文整理汇总了C#中BuilderContext.HasSet方法的典型用法代码示例。如果您正苦于以下问题:C# BuilderContext.HasSet方法的具体用法?C# BuilderContext.HasSet怎么用?C# BuilderContext.HasSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuilderContext
的用法示例。
在下文中一共展示了BuilderContext.HasSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeExpression
public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
{
var tassign = target as IDynamicAssign;
if (tassign == null)
throw new InternalErrorException (target.GetType () + " does not support dynamic assignment");
var target_object = tassign.MakeAssignExpression (ctx, source);
//
// Some hacking is needed as DLR does not support void type and requires
// always have object convertible return type to support caching and chaining
//
// We do this by introducing an explicit block which returns RHS value when
// available or null
//
if (target_object.NodeType == System.Linq.Expressions.ExpressionType.Block)
return target_object;
System.Linq.Expressions.UnaryExpression source_object;
if (ctx.HasSet (BuilderContext.Options.CheckedScope)) {
source_object = System.Linq.Expressions.Expression.ConvertChecked (source.MakeExpression (ctx), target_object.Type);
} else {
source_object = System.Linq.Expressions.Expression.Convert (source.MakeExpression (ctx), target_object.Type);
}
return System.Linq.Expressions.Expression.Assign (target_object, source_object);
}