Beispiel #1
0
 public TypeReference this[TypeReference type, ITypeImporter import]
 {
     get
     {
         TypeReference tNew;
         if (_dict.TryGetValue(type, out tNew))
         {
             return(import.Import(tNew));
         }
         var altKey = _dict.Keys.FirstOrDefault(r => r.FullName == type.FullName);
         if (altKey != null && _dict.TryGetValue(altKey, out tNew))
         {
             return(import.Import(tNew));
         }
         ByReferenceType byRef;
         if ((byRef = type as ByReferenceType) != null)
         {
             return(this[byRef.ElementType, import].MakeByReferenceType());
         }
         ArrayType arType;
         if ((arType = type as ArrayType) != null)
         {
             return(this[arType.ElementType, import].MakeArrayType(arType.Rank).ApplyDims(arType));
         }
         GenericInstanceType gnType;
         if ((gnType = type as GenericInstanceType) != null)
         {
             var args = gnType.GenericArguments.Select(a => this[a, import]).ToArray();
             return(this[gnType.ElementType, import].MakeGenericInstanceType(args));
         }
         if (type.IsInStandardLib())
         {
             return(import.Import(type));
         }
         return(type);
     }
 }