コード例 #1
0
 public static System.Type GetGenericCollectionType(System.Type type)
 {
     if (type == null)
     {
         return(null);
     }
     System.Type[] interfaces = PlatformTypeHelper.GetInterfaces(type);
     if (interfaces != null)
     {
         System.Type[] typeArray = interfaces;
         for (int i = 0; i < (int)typeArray.Length; i++)
         {
             System.Type genericCollectionTypeFromInterface = CollectionAdapterDescription.GetGenericCollectionTypeFromInterface(typeArray[i]);
             if (genericCollectionTypeFromInterface != null)
             {
                 return(genericCollectionTypeFromInterface);
             }
         }
     }
     if (!type.IsInterface)
     {
         return(null);
     }
     return(CollectionAdapterDescription.GetGenericCollectionTypeFromInterface(type));
 }