本文整理汇总了C#中System.Dynamic.BindingRestrictions类的典型用法代码示例。如果您正苦于以下问题:C# BindingRestrictions类的具体用法?C# BindingRestrictions怎么用?C# BindingRestrictions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindingRestrictions类属于System.Dynamic命名空间,在下文中一共展示了BindingRestrictions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:irxground,项目名称:kurogane,代码行数:7,代码来源:MapBinder.cs
示例2: CSharpBinder
public CSharpBinder (DynamicMetaObjectBinder binder, Compiler.Expression expr, DynamicMetaObject errorSuggestion)
{
this.binder = binder;
this.expr = expr;
this.restrictions = BindingRestrictions.Empty;
this.errorSuggestion = errorSuggestion;
}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:7,代码来源:CSharpBinder.cs
示例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;
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:12,代码来源:DynamicMetaObject.cs
示例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;
}
开发者ID:TerabyteX,项目名称:main,代码行数:31,代码来源:ComInvokeBinder.cs
示例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;
}
开发者ID:erlis,项目名称:IronSmalltalk,代码行数:7,代码来源:SmalltalkDynamicMetaObject.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:DynamicMetaObject.cs
示例7: TableMetaObject
public TableMetaObject(
Expression expression,
BindingRestrictions restrictions,
Table value)
: base(expression, restrictions, value)
{
}
开发者ID:jeffpanici75,项目名称:Tsuki,代码行数:7,代码来源:TableMetaObject.cs
示例8: MetaObjectBuilder
public MetaObjectBuilder(SilverMetaObject target, DynamicMetaObject[] args)
{
_restrictions = null;
if (target.Restrictions != BindingRestrictions.Empty) {
_restrictions = target.Restrictions;
}
}
开发者ID:shadowphoenix,项目名称:IronSilver,代码行数:7,代码来源:MetaObjectBuilder.cs
示例9: MetaObjectBuilder
internal MetaObjectBuilder(DynamicMetaObject target, params DynamicMetaObject/*!*/[]/*!*/ arguments) {
var restrictions = BindingRestrictions.Combine(arguments);
if (target != null) {
restrictions = target.Restrictions.Merge(restrictions);
}
_restrictions = restrictions;
}
开发者ID:toddb,项目名称:ironruby,代码行数:8,代码来源:MetaObjectBuilder.cs
示例10: Clear
private void Clear() {
_condition = null;
_restrictions = BindingRestrictions.Empty;
_result = null;
_initializations = null;
_error = false;
_treatRestrictionsAsConditions = false;
}
开发者ID:madpilot,项目名称:ironruby,代码行数:8,代码来源:MetaObjectBuilder.cs
示例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;
}
开发者ID:chcosta,项目名称:corefx,代码行数:13,代码来源:DynamicMetaObject.cs
示例12: InferenceResult
public InferenceResult(Type type, BindingRestrictions restrictions)
{
ContractUtils.RequiresNotNull(type, "type");
ContractUtils.RequiresNotNull(restrictions, "restrictions");
_type = type;
_restrictions = restrictions;
}
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:TypeInferer.cs
示例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
);
}
开发者ID:jschementi,项目名称:iron,代码行数:16,代码来源:DefaultBinder.MethodCalls.cs
示例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
}
开发者ID:Hank923,项目名称:ironruby,代码行数:12,代码来源:DefaultBinder.Conversions.cs
示例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;
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:DefaultBinder.Conversions.cs
示例16: PrepareArguments
/// <summary>
/// Prepares arguments for argfull overload.
/// </summary>
/// <param name="routine">Routine for which arguments should be prepared</param>
/// <param name="arguments">Arguments to be prepared for the routine</param>
/// <param name="genericArguments">Amount of generic arguments provided by call site.</param>
/// <param name="regularArguments">Amount of value arguments provided by call site.</param>
/// <param name="restrictions">Type restrictions for the arguments</param>
/// <returns>Array of prepared arguments to be called with routine</returns>
/// <remarks>
/// This is basically substitute for everything important that was done in argless overload (except it doesn't use PhpStack but evaluation stack).
/// It adopts the arguments according to routine. e.g. dereference reference if value is needed, supplies default argument, etc.
/// </remarks>
public static Expression[] PrepareArguments(this PhpRoutine routine, DynamicMetaObject[] arguments, int genericArguments, int regularArguments, out BindingRestrictions restrictions)
{
const int scriptContextIndex = 0;
DynamicMetaObject arg;
int result_offset = 0;
int argument_offset = 0;
Expression[] result = new Expression[1 + routine.Signature.GenericParamCount + routine.Signature.ParamCount];//ScriptContext + all arguments = actual arguments to be passed to argfull overload
restrictions = BindingRestrictions.Empty;
result[scriptContextIndex] = arguments[scriptContextIndex].Expression;
++result_offset;
++argument_offset;
// peek pseudo-generic arguments:
for (int i = 0; i < routine.Signature.GenericParamCount; ++i)
{
if (i < genericArguments)
{
arg = arguments[argument_offset + i];
}
else
{
arg = null;
}
result[result_offset + i] = GeneratePeekPseudoGenericArgument(routine, arguments[scriptContextIndex], arg, i);
// it isn't necessary to add restriction for type argument, it is always DTypeDesc
}
result_offset += routine.Signature.GenericParamCount;
argument_offset += genericArguments;
// peek regular arguments:
// skip first one ScriptContext and generic parameters
for (int i = 0; i < routine.Signature.ParamCount; ++i)
{
if (i < regularArguments)
{
arg = arguments[argument_offset + i];
if (arg.RuntimeType != null)
restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(arguments[argument_offset + i].Expression, arguments[argument_offset + i].LimitType));
else
restrictions = restrictions.Merge(BindingRestrictions.GetInstanceRestriction(arguments[argument_offset + i].Expression, null));//(MB) is it necessary?
}
else
{
arg = null;
}
result[result_offset + i] = GeneratePeekArgument(routine, arguments[scriptContextIndex], arg, i);
}
return result;
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:70,代码来源:PhpRoutineExtensions.cs
示例17: MetaObjectBuilder
private MetaObjectBuilder(RubyContext siteContext, DynamicMetaObject target, DynamicMetaObject/*!*/[]/*!*/ arguments) {
var restrictions = BindingRestrictions.Combine(arguments);
if (target != null) {
restrictions = target.Restrictions.Merge(restrictions);
}
_restrictions = restrictions;
_siteContext = siteContext;
}
开发者ID:madpilot,项目名称:ironruby,代码行数:9,代码来源:MetaObjectBuilder.cs
示例18: AddRestriction
public void AddRestriction(BindingRestrictions restriction)
{
if (_restrictions == null) {
_restrictions = restriction;
}
else {
_restrictions.Merge(restriction);
}
}
开发者ID:shadowphoenix,项目名称:IronSilver,代码行数:9,代码来源:MetaObjectBuilder.cs
示例19: Merge
/// <summary>
/// Merges the set of binding restrictions with the current binding restrictions.
/// </summary>
/// <param name="restrictions">The set of restrictions with which to merge the current binding restrictions.</param>
/// <returns>The new set of binding restrictions.</returns>
public BindingRestrictions Merge(BindingRestrictions restrictions) {
ContractUtils.RequiresNotNull(restrictions, "restrictions");
if (this == Empty) {
return restrictions;
}
if (restrictions == Empty) {
return this;
}
return new MergedRestriction(this, restrictions);
}
开发者ID:jcteague,项目名称:ironruby,代码行数:15,代码来源:BindingRestrictions.cs
示例20: TryConvertToObject
/// <summary>
/// Checks if the conversion is to object and produces a target if it is.
/// </summary>
private static DynamicMetaObject TryConvertToObject(Type toType, Type knownType, DynamicMetaObject arg, BindingRestrictions restrictions) {
if (toType == typeof(object)) {
if (knownType.IsValueType) {
return MakeBoxingTarget(arg, restrictions);
} else {
return new DynamicMetaObject(arg.Expression, restrictions);
}
}
return null;
}
开发者ID:BenHall,项目名称:ironruby,代码行数:13,代码来源:DefaultBinder.Conversions.cs
注:本文中的System.Dynamic.BindingRestrictions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论