// Token: 0x06005230 RID: 21040 RVA: 0x0011F730 File Offset: 0x0011D930
        internal static TypeInformation GetTypeInformation(Type type)
        {
            if (AppContextSwitches.UseConcurrentFormatterTypeCache)
            {
                return(BinaryFormatter.concurrentTypeNameCache.Value.GetOrAdd(type, delegate(Type t)
                {
                    bool hasTypeForwardedFrom2;
                    string clrAssemblyName2 = FormatterServices.GetClrAssemblyName(t, out hasTypeForwardedFrom2);
                    return new TypeInformation(FormatterServices.GetClrTypeFullName(t), clrAssemblyName2, hasTypeForwardedFrom2);
                }));
            }
            Dictionary <Type, TypeInformation> obj = BinaryFormatter.typeNameCache;
            TypeInformation result;

            lock (obj)
            {
                TypeInformation typeInformation = null;
                if (!BinaryFormatter.typeNameCache.TryGetValue(type, out typeInformation))
                {
                    bool   hasTypeForwardedFrom;
                    string clrAssemblyName = FormatterServices.GetClrAssemblyName(type, out hasTypeForwardedFrom);
                    typeInformation = new TypeInformation(FormatterServices.GetClrTypeFullName(type), clrAssemblyName, hasTypeForwardedFrom);
                    BinaryFormatter.typeNameCache.Add(type, typeInformation);
                }
                result = typeInformation;
            }
            return(result);
        }
Пример #2
0
 internal static TypeInformation GetTypeInformation(Type type)
 {
     lock (typeNameCache)
     {
         TypeInformation typeInformation = null;
         if (!typeNameCache.TryGetValue(type, out typeInformation))
         {
             typeInformation = new TypeInformation(FormatterServices.GetClrTypeFullName(type), FormatterServices.GetClrAssemblyName(type));
             typeNameCache.Add(type, typeInformation);
         }
         return(typeInformation);
     }
 }
Пример #3
0
 internal static TypeInformation GetTypeInformation(Type type)
 {
     lock (typeNameCache)
     {
         TypeInformation typeInformation = null;
         if (!typeNameCache.TryGetValue(type, out typeInformation))
         {
             bool   hasTypeForwardedFrom;
             string assemblyName = FormatterServices.GetClrAssemblyName(type, out hasTypeForwardedFrom);
             typeInformation = new TypeInformation(FormatterServices.GetClrTypeFullName(type), assemblyName, hasTypeForwardedFrom);
             typeNameCache.Add(type, typeInformation);
         }
         return(typeInformation);
     }
 }
Пример #4
0
 internal static TypeInformation GetTypeInformation(Type type)
 {
     lock (BinaryFormatter.typeNameCache)
     {
         TypeInformation local_2 = (TypeInformation)null;
         if (!BinaryFormatter.typeNameCache.TryGetValue(type, out local_2))
         {
             bool   local_3;
             string local_4 = FormatterServices.GetClrAssemblyName(type, out local_3);
             local_2 = new TypeInformation(FormatterServices.GetClrTypeFullName(type), local_4, local_3);
             BinaryFormatter.typeNameCache.Add(type, local_2);
         }
         return(local_2);
     }
 }
Пример #5
0
 internal static TypeInformation GetTypeInformation(Type type)
 {
     lock (typeNameCache)
     {
         TypeInformation information = null;
         if (!typeNameCache.TryGetValue(type, out information))
         {
             bool   flag;
             string clrAssemblyName = FormatterServices.GetClrAssemblyName(type, out flag);
             information = new TypeInformation(FormatterServices.GetClrTypeFullName(type), clrAssemblyName, flag);
             typeNameCache.Add(type, information);
         }
         return(information);
     }
 }
Пример #6
0
 internal static TypeInformation GetTypeInformation(Type type)
 {
     if (AppContextSwitches.UseConcurrentFormatterTypeCache)
     {
         return(concurrentTypeNameCache.Value.GetOrAdd(type, (t) =>
         {
             bool hasTypeForwardedFrom2;
             string assemblyName2 = FormatterServices.GetClrAssemblyName(t, out hasTypeForwardedFrom2);
             return new TypeInformation(FormatterServices.GetClrTypeFullName(t), assemblyName2, hasTypeForwardedFrom2);
         }));
     }
     lock (typeNameCache)
     {
         TypeInformation typeInformation = null;
         if (!typeNameCache.TryGetValue(type, out typeInformation))
         {
             bool   hasTypeForwardedFrom;
             string assemblyName = FormatterServices.GetClrAssemblyName(type, out hasTypeForwardedFrom);
             typeInformation = new TypeInformation(FormatterServices.GetClrTypeFullName(type), assemblyName, hasTypeForwardedFrom);
             typeNameCache.Add(type, typeInformation);
         }
         return(typeInformation);
     }
 }
Пример #7
0
 internal static TypeInformation GetTypeInformation(Type type) =>
 s_typeNameCache.GetOrAdd(type, t =>
 {
     string assemblyName = FormatterServices.GetClrAssemblyName(t, out bool hasTypeForwardedFrom);
     return(new TypeInformation(FormatterServices.GetClrTypeFullName(t), assemblyName, hasTypeForwardedFrom));
 });