本文整理汇总了C#中System.Dynamic.BindingRestrictions类的典型用法代码示例。如果您正苦于以下问题:C# BindingRestrictions类的具体用法?C# BindingRestrictions怎么用?C# BindingRestrictions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BindingRestrictions类属于System.Dynamic命名空间,在下文中一共展示了BindingRestrictions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThrowArgumentException
private static DynamicMetaObject ThrowArgumentException(string message, BindingRestrictions restrictions)
{
var ctorInfo = typeof(InvalidOperationException).GetConstructor(new[] { typeof(string) });
return new DynamicMetaObject(
Expression.Throw(Expression.New(ctorInfo, Expression.Constant(message)), typeof(object)),
restrictions);
}
示例2: CSharpBinder
public CSharpBinder (DynamicMetaObjectBinder binder, Compiler.Expression expr, DynamicMetaObject errorSuggestion)
{
this.binder = binder;
this.expr = expr;
this.restrictions = BindingRestrictions.Empty;
this.errorSuggestion = errorSuggestion;
}
示例3: DynamicMetaObject
/// <summary>
/// Initializes a new instance of the <see cref="DynamicMetaObject"/> class.
/// </summary>
/// <param name="expression">The expression representing this <see cref="DynamicMetaObject"/> during the dynamic binding process.</param>
/// <param name="restrictions">The set of binding restrictions under which the binding is valid.</param>
public DynamicMetaObject(Expression expression, BindingRestrictions restrictions) {
ContractUtils.RequiresNotNull(expression, "expression");
ContractUtils.RequiresNotNull(restrictions, "restrictions");
_expression = expression;
_restrictions = restrictions;
}
示例4: ComInvokeBinder
internal ComInvokeBinder(
CallInfo callInfo,
DynamicMetaObject[] args,
bool[] isByRef,
BindingRestrictions restrictions,
Expression method,
Expression dispatch,
ComMethodDesc methodDesc
)
{
Debug.Assert(callInfo != null, "arguments");
Debug.Assert(args != null, "args");
Debug.Assert(isByRef != null, "isByRef");
Debug.Assert(method != null, "method");
Debug.Assert(dispatch != null, "dispatch");
Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(ComMethodDesc), method.Type), "method");
Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(IDispatch), dispatch.Type), "dispatch");
_method = method;
_dispatch = dispatch;
_methodDesc = methodDesc;
_callInfo = callInfo;
_args = args;
_isByRef = isByRef;
_restrictions = restrictions;
// Set Instance to some value so that CallBinderHelper has the right number of parameters to work with
_instance = dispatch;
}
示例5: SmalltalkDynamicMetaObject
public SmalltalkDynamicMetaObject(Expression expression, BindingRestrictions restrictions, SmalltalkClass cls, object value)
: base(expression, restrictions, value)
{
if (cls == null)
throw new ArgumentNullException("cls");
this.Class = cls;
}
示例6: DynamicMetaObject
public DynamicMetaObject(System.Linq.Expressions.Expression expression, BindingRestrictions restrictions)
{
ContractUtils.RequiresNotNull(expression, "expression");
ContractUtils.RequiresNotNull(restrictions, "restrictions");
this._expression = expression;
this._restrictions = restrictions;
}
示例7: TableMetaObject
public TableMetaObject(
Expression expression,
BindingRestrictions restrictions,
Table value)
: base(expression, restrictions, value)
{
}
示例8: MetaObjectBuilder
public MetaObjectBuilder(SilverMetaObject target, DynamicMetaObject[] args)
{
_restrictions = null;
if (target.Restrictions != BindingRestrictions.Empty) {
_restrictions = target.Restrictions;
}
}
示例9: MetaObjectBuilder
internal MetaObjectBuilder(DynamicMetaObject target, params DynamicMetaObject/*!*/[]/*!*/ arguments) {
var restrictions = BindingRestrictions.Combine(arguments);
if (target != null) {
restrictions = target.Restrictions.Merge(restrictions);
}
_restrictions = restrictions;
}
示例10: Clear
private void Clear() {
_condition = null;
_restrictions = BindingRestrictions.Empty;
_result = null;
_initializations = null;
_error = false;
_treatRestrictionsAsConditions = false;
}
示例11: DynamicMetaObject
/// <summary>
/// Initializes a new instance of the <see cref="DynamicMetaObject"/> class.
/// </summary>
/// <param name="expression">The expression representing this <see cref="DynamicMetaObject"/> during the dynamic binding process.</param>
/// <param name="restrictions">The set of binding restrictions under which the binding is valid.</param>
public DynamicMetaObject(Expression expression, BindingRestrictions restrictions)
{
ContractUtils.RequiresNotNull(expression, nameof(expression));
ContractUtils.RequiresNotNull(restrictions, nameof(restrictions));
Expression = expression;
Restrictions = restrictions;
}
示例12: InferenceResult
public InferenceResult(Type type, BindingRestrictions restrictions)
{
ContractUtils.RequiresNotNull(type, "type");
ContractUtils.RequiresNotNull(restrictions, "restrictions");
_type = type;
_restrictions = restrictions;
}
示例13: CallMethod
/// <summary>
/// Performs binding against a set of overloaded methods using the specified arguments. The arguments are
/// consumed as specified by the CallSignature object.
/// </summary>
/// <param name="resolver">Overload resolver.</param>
/// <param name="targets">The methods to be called</param>
/// <param name="restrictions">Additional restrictions which should be applied to the resulting MetaObject.</param>
/// <returns>A meta object which results from the call.</returns>
public DynamicMetaObject CallMethod(DefaultOverloadResolver resolver, IList<MethodBase> targets, BindingRestrictions restrictions) {
return CallMethod(
resolver,
targets,
restrictions,
null
);
}
示例14: TryAllConversions
/// <summary>
/// Checks if any conversions are available and if so builds the target for that conversion.
/// </summary>
private DynamicMetaObject TryAllConversions(Type toType, ConversionResultKind kind, Type knownType, BindingRestrictions restrictions, DynamicMetaObject arg) {
return
TryAssignableConversion(toType, knownType, restrictions, arg) ?? // known type -> known type
TryExtensibleConversion(toType, knownType, restrictions, arg) ?? // Extensible<T> -> Extensible<T>.Value
TryUserDefinedConversion(kind, toType, knownType, restrictions, arg) ?? // op_Implicit
TryImplicitNumericConversion(toType, knownType, restrictions, arg) ?? // op_Implicit
TryNullableConversion(toType, kind, knownType, restrictions, arg) ?? // null -> Nullable<T> or T -> Nullable<T>
TryNullConversion(toType, knownType, restrictions); // null -> reference type
}
示例15: TryAssignableConversion
/// <summary>
/// Checks if the conversion can be handled by a simple cast.
/// </summary>
private static DynamicMetaObject TryAssignableConversion(Type toType, Type type, BindingRestrictions restrictions, DynamicMetaObject arg) {
if (toType.IsAssignableFrom(type) ||
(type == typeof(DynamicNull) && (toType.IsClass || toType.IsInterface))) {
// MakeSimpleConversionTarget handles the ConversionResultKind check
return MakeSimpleConversionTarget(toType, restrictions, arg);
}
return null;
}