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


C# IILGen.Castclass方法代码示例

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


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

示例1: GenerateLoadEx

 public static void GenerateLoadEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type asType, ITypeConvertorGenerator convertorGenerator)
 {
     if (descriptor.StoredInline)
     {
         if (descriptor.LoadNeedsHelpWithConversion && asType!=typeof(object))
         {
             var origType = descriptor.GetPreferedType();
             descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, origType);
             if (origType != asType)
             {
                 var conv = convertorGenerator.GenerateConversion(origType, asType);
                 if (conv == null)
                     throw new BTDBException("Don't know how to convert " + descriptor.Name + " from " +
                                             origType.ToSimpleName() + " to " + asType.ToSimpleName());
                 conv(ilGenerator);
             }
         }
         else
         {
             descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, asType);
         }
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Callvirt(() => default(ITypeBinaryDeserializerContext).LoadObject());
         if (asType != typeof(object))
             ilGenerator.Castclass(asType);
     }
 }
开发者ID:Bobris,项目名称:BTDB,代码行数:31,代码来源:TypeDescriptorExtensions.cs

示例2: GenerateLoadEx

 public static void GenerateLoadEx(this ITypeDescriptor descriptor, IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type asType)
 {
     if (descriptor.StoredInline)
     {
         descriptor.GenerateLoad(ilGenerator, pushReader, pushCtx, pushDescriptor, asType);
     }
     else
     {
         ilGenerator
             .Do(pushCtx)
             .Callvirt(() => default(ITypeBinaryDeserializerContext).LoadObject());
         if (asType != typeof(object))
             ilGenerator.Castclass(asType);
     }
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:15,代码来源:TypeDescriptorExtensions.cs

示例3: GenerateLoad

 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(() => default(AbstractBufferedReader).ReadByteArray());
     if (targetType == typeof (ByteBuffer))
     {
         ilGenerator.Call(() => ByteBuffer.NewAsync(null));
         return;
     }
     if (targetType != typeof (object))
     {
         if (targetType!=typeof(byte[]))
             throw new ArgumentOutOfRangeException(nameof(targetType));
         return;
     }
     ilGenerator.Castclass(typeof(object));
 }
开发者ID:Xamarui,项目名称:BTDB,代码行数:17,代码来源:ByteArrayTypeDescriptor.cs

示例4: GenerateLoad

 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     Type typeRead;
     if (_signed)
     {
         ilGenerator.Call(() => default(AbstractBufferedReader).ReadVInt64());
         typeRead = typeof(long);
     }
     else
     {
         ilGenerator.Call(() => default(AbstractBufferedReader).ReadVUInt64());
         typeRead = typeof(ulong);
     }
     if (targetType == typeof(object))
     {
         ilGenerator.Do(pushDescriptor);
         if (_signed)
         {
             ilGenerator.Newobj(() => new DynamicEnum(0L, null));
         }
         else
         {
             ilGenerator.Newobj(() => new DynamicEnum(0UL, null));
         }
         ilGenerator.Castclass(typeof(object));
         return;
     }
     new DefaultTypeConvertorGenerator().GenerateConversion(typeRead, targetType.GetEnumUnderlyingType())(ilGenerator);
 }
开发者ID:klesta490,项目名称:BTDB,代码行数:30,代码来源:EnumTypeDescriptor.cs

示例5: GenerateLoad

 public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType)
 {
     pushReader(ilGenerator);
     ilGenerator.Call(_loader);
     if (targetType != typeof(object))
     {
         if (targetType != GetPreferedType())
             throw new ArgumentOutOfRangeException(nameof(targetType));
         return;
     }
     if (GetPreferedType().IsValueType)
     {
         ilGenerator.Box(GetPreferedType());
     }
     else
     {
         ilGenerator.Castclass(typeof(object));
     }
 }
开发者ID:klesta490,项目名称:BTDB,代码行数:19,代码来源:SimpleTypeDescriptor.cs


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