public StaticAccess Add(GenericName identifier) { var type = Type; var name = identifier.Name; var typeArguments = identifier.TypeArguments; if (typeArguments != Type.EmptyTypes) { name += "`" + typeArguments.Length; } var nestedType = type.GetNestedType(name); if (nestedType == null) { return(new StaticAccess(type, identifier)); } if (typeArguments != Type.EmptyTypes) { nestedType = nestedType.MakeGenericType(typeArguments); } return(new StaticAccess(nestedType, null)); }
public QualifiedType Add(GenericName identifier, ITypeResolver resolver) { var type = Type; if (type != null) { throw new InvalidOperationException("Cannot further qualify an existing type."); } var typeArguments = identifier.TypeArguments; var typeName = TypeName != null ? TypeName + "." + identifier.Name : identifier.Name; if (typeArguments != Type.EmptyTypes) { typeName += "`" + typeArguments.Length; } type = resolver.GetType(typeName); if (typeArguments != Type.EmptyTypes) { type = type.MakeGenericType(typeArguments); } return(new QualifiedType(type, typeName)); }