public GenericTypeName(Type type, TypeNameFlag flags) : base(type) { Namespace = new Namespace(type.Namespace); EnclosingNames = new EnclosingNameList(); Generics = new GenericList(); var visitor = new GenericVisitor(type); { var super = type.DeclaringType; while (super != null) { if (super.IsGenericType) { EnclosingNames.AddBefore(new TypeNameView(super, visitor, flags)); } else { EnclosingNames.AddBefore(new TypeNameView(super)); } super = super.DeclaringType; } } var genericName = type.Name; var iQuota = genericName.LastIndexOf('`'); int lenGeneric; if (iQuota > 0) { Name = iQuota < 0 ? genericName : genericName.Substring(0, iQuota); lenGeneric = int.Parse(genericName.Substring(iQuota + 1)); } else { Name = genericName; lenGeneric = 0; } for (var i = 0; i < lenGeneric; i++) { Generics.Add(TypeNameFactory.Create(visitor.Next(), flags)); } }
internal DirectTypeName(Type type) : base(type) { Namespace = new Namespace(type.Namespace); { EnclosingNames = new EnclosingNameList(); var super = type.DeclaringType; while (super != null) { EnclosingNames.AddBefore(new TypeNameView(super)); super = super.DeclaringType; } } Name = type.Name; }