当前位置: 首页>>代码示例>>C#>>正文


C# DynamicMetaObject.WriteToDebugLog方法代码示例

本文整理汇总了C#中System.Dynamic.DynamicMetaObject.WriteToDebugLog方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicMetaObject.WriteToDebugLog方法的具体用法?C# DynamicMetaObject.WriteToDebugLog怎么用?C# DynamicMetaObject.WriteToDebugLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Dynamic.DynamicMetaObject的用法示例。


在下文中一共展示了DynamicMetaObject.WriteToDebugLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FallbackConvert

 public override DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion)
 {
     bool flag;
     if (!target.HasValue)
     {
         return base.Defer(target, new DynamicMetaObject[0]).WriteToDebugLog(this);
     }
     if (target.Value == AutomationNull.Value)
     {
         return new DynamicMetaObject(Expression.Default(base.Type), target.PSGetTypeRestriction()).WriteToDebugLog(this);
     }
     Type resultType = base.Type;
     LanguagePrimitives.ConversionData conversion = LanguagePrimitives.FigureConversion(target.Value, resultType, out flag);
     if ((errorSuggestion != null) && (target.Value is DynamicObject))
     {
         return errorSuggestion.WriteToDebugLog(this);
     }
     BindingRestrictions restrictions = target.PSGetTypeRestriction().Merge(BinderUtils.GetOptionalVersionAndLanguageCheckForType(this, resultType, this._version));
     return new DynamicMetaObject(InvokeConverter(conversion, target.Expression, resultType, flag, ExpressionCache.InvariantCulture), restrictions).WriteToDebugLog(this);
 }
开发者ID:nickchal,项目名称:pash,代码行数:20,代码来源:PSConvertBinder.cs

示例2: FallbackSetMember

 public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
 {
     PSMemberInfo info;
     BindingRestrictions restrictions2;
     bool flag3;
     Type type4;
     if (!target.HasValue || !value.HasValue)
     {
         return base.Defer(target, new DynamicMetaObject[] { value });
     }
     object obj2 = PSObject.Base(target.Value);
     if (obj2 == null)
     {
         return target.ThrowRuntimeError(new DynamicMetaObject[] { value }, BindingRestrictions.Empty, "PropertyNotFound", ParserStrings.PropertyNotFound, new Expression[] { Expression.Constant(base.Name) }).WriteToDebugLog(this);
     }
     if (value.Value == AutomationNull.Value)
     {
         value = new DynamicMetaObject(ExpressionCache.NullConstant, value.PSGetTypeRestriction(), null);
     }
     if (this._getMemberBinder.HasInstanceMember && PSGetMemberBinder.TryGetInstanceMember(target.Value, base.Name, out info))
     {
         ParameterExpression expression = Expression.Variable(typeof(PSMemberInfo));
         ParameterExpression expression2 = Expression.Variable(typeof(object));
         ConditionalExpression expression3 = Expression.Condition(Expression.Call(CachedReflectionInfo.PSGetMemberBinder_TryGetInstanceMember, target.Expression.Cast(typeof(object)), Expression.Constant(base.Name), expression), Expression.Assign(Expression.Property(expression, "Value"), value.Expression.Cast(typeof(object))), base.GetUpdateExpression(typeof(object)));
         BindingRestrictions restrictions = BinderUtils.GetVersionCheck(this._getMemberBinder, this._getMemberBinder._version).Merge(value.PSGetTypeRestriction());
         return new DynamicMetaObject(Expression.Block(new ParameterExpression[] { expression, expression2 }, new Expression[] { expression3 }), restrictions).WriteToDebugLog(this);
     }
     if (obj2 is IDictionary)
     {
         Type genericTypeArg = null;
         bool flag = PSGetMemberBinder.IsGenericDictionary(obj2, ref genericTypeArg);
         if (!flag || (genericTypeArg != null))
         {
             bool flag2;
             Type type = flag ? typeof(IDictionary<,>).MakeGenericType(new Type[] { typeof(string), genericTypeArg }) : typeof(IDictionary);
             MethodInfo method = type.GetMethod("set_Item");
             ParameterExpression left = Expression.Variable(genericTypeArg ?? typeof(object));
             Type resultType = left.Type;
             LanguagePrimitives.ConversionData conversion = LanguagePrimitives.FigureConversion(value.Value, resultType, out flag2);
             if (conversion.Rank != ConversionRank.None)
             {
                 Expression right = PSConvertBinder.InvokeConverter(conversion, value.Expression, resultType, flag2, ExpressionCache.InvariantCulture);
                 return new DynamicMetaObject(Expression.Block(new ParameterExpression[] { left }, new Expression[] { Expression.Assign(left, right), Expression.Call(PSGetMemberBinder.GetTargetExpr(target).Cast(type), method, Expression.Constant(base.Name), right), right.Cast(typeof(object)) }), target.CombineRestrictions(new DynamicMetaObject[] { value })).WriteToDebugLog(this);
             }
         }
     }
     info = this._getMemberBinder.GetPSMemberInfo(target, out restrictions2, out flag3, out type4, null, null);
     restrictions2 = restrictions2.Merge(value.PSGetTypeRestriction());
     if (ExecutionContext.HasEverUsedConstrainedLanguage)
     {
         restrictions2 = restrictions2.Merge(BinderUtils.GetLanguageModeCheckIfHasEverUsedConstrainedLanguage());
         DynamicMetaObject obj3 = PSGetMemberBinder.EnsureAllowedInLanguageMode(LocalPipeline.GetExecutionContextFromTLS().LanguageMode, target, obj2, base.Name, this._static, new DynamicMetaObject[] { value }, restrictions2, "PropertySetterNotSupportedInConstrainedLanguage", ParserStrings.PropertySetConstrainedLanguage);
         if (obj3 != null)
         {
             return obj3.WriteToDebugLog(this);
         }
     }
     if (flag3)
     {
         if (info == null)
         {
             return (errorSuggestion ?? new DynamicMetaObject(Compiler.ThrowRuntimeError("PropertyAssignmentException", ParserStrings.PropertyNotFound, this.ReturnType, new Expression[] { Expression.Constant(base.Name) }), restrictions2)).WriteToDebugLog(this);
         }
         PSPropertyInfo info3 = info as PSPropertyInfo;
         if (info3 != null)
         {
             if (!info3.IsSettable)
             {
                 Expression innerException = Expression.New(CachedReflectionInfo.SetValueException_ctor, new Expression[] { Expression.Constant("PropertyAssignmentException"), Expression.Constant(null, typeof(Exception)), Expression.Constant(ParserStrings.PropertyIsReadOnly), Expression.NewArrayInit(typeof(object), new Expression[] { Expression.Constant(base.Name) }) });
                 return new DynamicMetaObject(Compiler.ThrowRuntimeErrorWithInnerException("PropertyAssignmentException", Expression.Constant(ParserStrings.PropertyIsReadOnly), innerException, this.ReturnType, new Expression[] { Expression.Constant(base.Name) }), restrictions2).WriteToDebugLog(this);
             }
             PSProperty property = info3 as PSProperty;
             if (property != null)
             {
                 DotNetAdapter.PropertyCacheEntry adapterData = property.adapterData as DotNetAdapter.PropertyCacheEntry;
                 if (adapterData != null)
                 {
                     Expression expression10;
                     Type propertyType;
                     if (adapterData.member.DeclaringType.IsGenericTypeDefinition)
                     {
                         Expression expression9 = Expression.New(CachedReflectionInfo.SetValueException_ctor, new Expression[] { Expression.Constant("PropertyAssignmentException"), Expression.Constant(null, typeof(Exception)), Expression.Constant(ExtendedTypeSystem.CannotInvokeStaticMethodOnUninstantiatedGenericType), Expression.NewArrayInit(typeof(object), new Expression[] { Expression.Constant(adapterData.member.DeclaringType.FullName) }) });
                         return new DynamicMetaObject(Compiler.ThrowRuntimeErrorWithInnerException("PropertyAssignmentException", Expression.Constant(ExtendedTypeSystem.CannotInvokeStaticMethodOnUninstantiatedGenericType), expression9, this.ReturnType, new Expression[] { Expression.Constant(adapterData.member.DeclaringType.FullName) }), restrictions2).WriteToDebugLog(this);
                     }
                     PropertyInfo member = adapterData.member as PropertyInfo;
                     if (member != null)
                     {
                         propertyType = member.PropertyType;
                         Expression expression11 = this._static ? null : PSGetMemberBinder.GetTargetExpr(target);
                         expression10 = Expression.Property(expression11, member);
                     }
                     else
                     {
                         FieldInfo field = (FieldInfo) adapterData.member;
                         propertyType = field.FieldType;
                         Expression expression12 = this._static ? null : PSGetMemberBinder.GetTargetExpr(target);
                         expression10 = Expression.Field(expression12, field);
                     }
                     Type underlyingType = Nullable.GetUnderlyingType(propertyType);
                     Type type7 = underlyingType ?? propertyType;
//.........这里部分代码省略.........
开发者ID:nickchal,项目名称:pash,代码行数:101,代码来源:PSSetMemberBinder.cs


注:本文中的System.Dynamic.DynamicMetaObject.WriteToDebugLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。