Beispiel #1
0
 public TypeRef Clone() => new TypeRef()
 {
     ArrayDimensions          = ArrayDimensions,
     GenericParameters        = GenericParameters?.Select(gp => gp.Clone()).ToArray(),
     IsPrimitive              = IsPrimitive,
     IsConstructedGenericType = IsConstructedGenericType,
     IsEnum                  = IsEnum,
     IsGenericParameter      = IsGenericParameter,
     IsGenericTypeDefinition = IsGenericTypeDefinition,
     IsWellKnown             = IsWellKnown,
     Name        = Name,
     Namespace   = Namespace,
     NestedIn    = NestedIn?.Clone(),
     Wrapped     = Wrapped?.Select(w => w.Clone()).ToArray(),
     IsInterface = IsInterface
 };
Beispiel #2
0
        public HashSet <TypeRef> AddSelfAndReferencedTypeRefs(HashSet <TypeRef> existingList)
        {
            if (!existingList.Add(this))
            {
                return(existingList);
            }

            if (NestedIn != null)
            {
                NestedIn.AddSelfAndReferencedTypeRefs(existingList);
            }

            foreach (var currentWrapped in Wrapped.EmptyIfNull())
            {
                currentWrapped.AddSelfAndReferencedTypeRefs(existingList);
            }
            return(existingList);
        }
Beispiel #3
0
        public string GenerateNameWithoutGenericsAndArrays()
        {
            string theReturn;

            if (NestedIn != null)
            {
                theReturn = $"{NestedIn.GenerateName()}.{Name}";
            }
            else if (!string.IsNullOrEmpty(Namespace))
            {
                theReturn = $"{Namespace}.{Name}";
            }
            else
            {
                theReturn = Name;
            }

            if (theReturn == null)
            {
                theReturn = string.Empty;
            }
            return(theReturn);
        }