/// <summary> /// Uses the specified interning provider to intern /// strings and lists in this entity. /// This method does not test arbitrary objects to see if they implement ISupportsInterning; /// instead we assume that those are interned immediately when they are created (before they are added to this entity). /// </summary> public virtual void ApplyInterningProvider(InterningProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } FreezableHelper.ThrowIfFrozen(this); name = provider.Intern(name); constraints = provider.InternList(constraints); }
/// <summary> /// Adds a type forwarder. /// This adds both an assembly attribute and an internal forwarder entry, which will be used /// by the resolved assembly to provide the forwarded types. /// </summary> /// <param name="typeName">The name of the type.</param> /// <param name="referencedType">The reference used to look up the type in the target assembly.</param> public void AddTypeForwarder(TopLevelTypeName typeName, ITypeReference referencedType) { if (referencedType == null) { throw new ArgumentNullException("referencedType"); } FreezableHelper.ThrowIfFrozen(this); typeForwarders[typeName] = referencedType; }
/// <summary> /// Adds a new top-level type definition to this assembly. /// </summary> /// <remarks>UnresolvedAssemblySpec does not support partial classes. /// Adding more than one part of a type will cause an ArgumentException.</remarks> public void AddTypeDefinition(IUnresolvedTypeDefinition typeDefinition) { if (typeDefinition == null) { throw new ArgumentNullException("typeDefinition"); } if (typeDefinition.DeclaringTypeDefinition != null) { throw new ArgumentException("Cannot add nested types."); } FreezableHelper.ThrowIfFrozen(this); var key = new TopLevelTypeName(typeDefinition.Namespace, typeDefinition.Name, typeDefinition.TypeParameters.Count); typeDefinitions.Add(key, typeDefinition); }