Example #1
0
 static ZLangBasicTypes()
 {
     if (ZVOID == null)
     {
         ZTypeManager.InitZLangBasicTypes();
     }
 }
Example #2
0
        public static ZLType GetBySharpType(Type type)
        {
            if (type == null)
            {
                return(null);
            }
            else if (Cache.SharpCache.ContainsKey(type))
            {
                return(Cache.SharpCache[type]);
            }
            else if (type.IsGenericType)
            {
                if (type.IsGenericTypeDefinition)
                {
                    return(null);
                }
                /* 检查类型的泛型类型是否存在 */
                Type typeParentGeneric = type.GetGenericTypeDefinition();
                if (!Cache.SharpCache.ContainsKey(typeParentGeneric))
                {
                    return(null);
                }
                /* 检查类型的参数类型是否存在 */
                Type[] typeArguments = type.GetGenericArguments();
                foreach (Type tParam in typeArguments)
                {
                    if (!Cache.SharpCache.ContainsKey(tParam))
                    {
                        return(null);
                    }
                }
                ZType newZtype = ZTypeManager.RegNewGenericType(type);
                return((ZLType)newZtype);
            }

            return(null);
        }