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


C# IReflect.GetType方法代码示例

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


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

示例1: ToType

 internal static Type ToType(IReflect ir){
   if (ir is Type)
     return (Type)ir;
   if (ir is ClassScope)
     return ((ClassScope)ir).GetTypeBuilderOrEnumBuilder();
   if (ir is TypedArray){
     return ((TypedArray)ir).ToType();
   }
   if (ir is ScriptFunction)
     return Typeob.ScriptFunction;
   return ir.GetType();
 }
开发者ID:ArildF,项目名称:masters,代码行数:12,代码来源:convert.cs

示例2: ToType

 internal static Type ToType(TypeReferences typeRefs, IReflect ir){
   if (ir is Type)
     return (Type)ir;
   if (ir is ClassScope)
     return ((ClassScope)ir).GetTypeBuilderOrEnumBuilder();
   if (ir is TypedArray){
     return typeRefs.ToReferenceContext(((TypedArray)ir).ToType());
   }
   if (ir is ScriptFunction)
     return typeRefs.ScriptFunction;
   return typeRefs.ToReferenceContext(ir.GetType());
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:12,代码来源:convert.cs

示例3: IsPromotableTo

 internal static bool IsPromotableTo(IReflect source_ir, IReflect target_ir){
   Type target_type;
   if (source_ir is TypedArray || target_ir is TypedArray ||
       source_ir is ArrayObject || target_ir is ArrayObject ||
       source_ir == Typeob.ArrayObject || target_ir == Typeob.ArrayObject)
     return Convert.IsPromotableToArray(source_ir, target_ir);
   if (target_ir is ClassScope){
     if (((ClassScope)target_ir).owner is EnumDeclaration){
       if (Convert.IsPrimitiveNumericType(source_ir))
         return IsPromotableTo(source_ir, ((EnumDeclaration)((ClassScope)target_ir).owner).baseType.ToType());
       else if (source_ir == Typeob.String) return true;
       else if (source_ir == target_ir) return true;
       return false;
     }
     if (source_ir is ClassScope)
       return (((ClassScope)source_ir).IsSameOrDerivedFrom((ClassScope)target_ir));
     return false; //The source is not in the same compilation unit. Thus it can only extend the target type if there is a circular dependency and separate compilation. Can't handle that.
   }else if (target_ir is Type){
     if (target_ir == Typeob.Object) return !(source_ir is Type) || !((Type)source_ir).IsByRef;
     target_type = (Type)target_ir;
   }else if (target_ir is ScriptFunction)
     target_type = Typeob.ScriptFunction;
   else
     //assert that target_ir is JSObject
     target_type = target_ir.GetType();
   if (source_ir is ClassScope)
     return ((ClassScope)source_ir).IsPromotableTo(target_type);
   else
     return IsPromotableTo(source_ir is Type ? (Type)source_ir : source_ir.GetType(), target_type);
 }
开发者ID:ArildF,项目名称:masters,代码行数:30,代码来源:convert.cs

示例4: IsPromotableTo

 internal static bool IsPromotableTo(IReflect source_ir, IReflect target_ir)
 {
     Type scriptFunction;
     if ((((source_ir is TypedArray) || (target_ir is TypedArray)) || ((source_ir is ArrayObject) || (target_ir is ArrayObject))) || ((source_ir == Typeob.ArrayObject) || (target_ir == Typeob.ArrayObject)))
     {
         return IsPromotableToArray(source_ir, target_ir);
     }
     if (target_ir is ClassScope)
     {
         if (((ClassScope) target_ir).owner is EnumDeclaration)
         {
             if (IsPrimitiveNumericType(source_ir))
             {
                 return IsPromotableTo(source_ir, ((EnumDeclaration) ((ClassScope) target_ir).owner).baseType.ToType());
             }
             return ((source_ir == Typeob.String) || (source_ir == target_ir));
         }
         return ((source_ir is ClassScope) && ((ClassScope) source_ir).IsSameOrDerivedFrom((ClassScope) target_ir));
     }
     if (target_ir is Type)
     {
         if (target_ir == Typeob.Object)
         {
             if (source_ir is Type)
             {
                 return !((Type) source_ir).IsByRef;
             }
             return true;
         }
         scriptFunction = (Type) target_ir;
     }
     else if (target_ir is ScriptFunction)
     {
         scriptFunction = Typeob.ScriptFunction;
     }
     else
     {
         scriptFunction = Globals.TypeRefs.ToReferenceContext(target_ir.GetType());
     }
     if (source_ir is ClassScope)
     {
         return ((ClassScope) source_ir).IsPromotableTo(scriptFunction);
     }
     return IsPromotableTo((source_ir is Type) ? ((Type) source_ir) : Globals.TypeRefs.ToReferenceContext(source_ir.GetType()), scriptFunction);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:Convert.cs


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