示例#1
0
文件: Dispensers.cs 项目: rivy/corert
 private static RuntimeTypeInfo CreateRuntimeTypeInfo(RuntimeType runtimeType)
 {
     if (runtimeType.HasElementType)
     {
         if (runtimeType.IsArray)
         {
             return(RuntimeArrayTypeInfo.GetRuntimeArrayTypeInfo(runtimeType));
         }
         else
         {
             return(RuntimeHasElementTypeInfo.GetRuntimeHasElementypeInfo(runtimeType));
         }
     }
     else if (runtimeType.IsConstructedGenericType)
     {
         RuntimeTypeHandle typeHandle;
         if (runtimeType.InternalTryGetTypeHandle(out typeHandle) && ReflectionCoreExecution.ExecutionEnvironment.IsReflectionBlocked(typeHandle))
         {
             return(RuntimeBlockedTypeInfo.GetRuntimeBlockedTypeInfo(runtimeType));
         }
         return(RuntimeConstructedGenericTypeInfo.GetRuntimeConstructedGenericTypeInfo(runtimeType));
     }
     else
     {
         RuntimeInspectionOnlyNamedType inspectionOnlyNamedType = runtimeType as RuntimeInspectionOnlyNamedType;
         if (inspectionOnlyNamedType != null)
         {
             return(inspectionOnlyNamedType.GetInspectionOnlyNamedRuntimeTypeInfo());
         }
         else
         {
             RuntimeGenericParameterType genericParameterType = runtimeType as RuntimeGenericParameterType;
             if (genericParameterType != null)
             {
                 return(RuntimeGenericParameterTypeInfo.GetRuntimeGenericParameterTypeInfo(genericParameterType));
             }
             else
             {
                 MetadataReader       reader;
                 TypeDefinitionHandle typeDefHandle;
                 if (ReflectionCoreExecution.ExecutionEnvironment.TryGetMetadataForNamedType(runtimeType.TypeHandle, out reader, out typeDefHandle))
                 {
                     return(RuntimeNamedTypeInfo.GetRuntimeNamedTypeInfo(reader, typeDefHandle));
                 }
                 if (ReflectionCoreExecution.ExecutionEnvironment.IsReflectionBlocked(runtimeType.TypeHandle))
                 {
                     return(RuntimeBlockedTypeInfo.GetRuntimeBlockedTypeInfo(runtimeType));
                 }
                 else
                 {
                     return(RuntimeNoMetadataNamedTypeInfo.GetRuntimeNoMetadataNamedTypeInfo(runtimeType));
                 }
             }
         }
     }
 }
        public sealed override bool Equals(Object obj)
        {
            RuntimeGenericParameterTypeInfo other = obj as RuntimeGenericParameterTypeInfo;

            if (other == null)
            {
                return(false);
            }
            return(this._asType.Equals(other._asType));
        }