Пример #1
0
 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));
                 }
             }
         }
     }
 }
Пример #2
0
        public sealed override bool Equals(Object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            RuntimeBlockedTypeInfo other = obj as RuntimeBlockedTypeInfo;

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