Edit

Share via


Container.ValidateName(IComponent, String) Method

Definition

Determines whether the component name is unique for this container.

protected:
 virtual void ValidateName(System::ComponentModel::IComponent ^ component, System::String ^ name);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of components in the container cannot be statically discovered.")]
protected virtual void ValidateName(System.ComponentModel.IComponent component, string? name);
protected virtual void ValidateName(System.ComponentModel.IComponent component, string name);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of components in the container cannot be statically discovered.")>]
abstract member ValidateName : System.ComponentModel.IComponent * string -> unit
override this.ValidateName : System.ComponentModel.IComponent * string -> unit
abstract member ValidateName : System.ComponentModel.IComponent * string -> unit
override this.ValidateName : System.ComponentModel.IComponent * string -> unit
Protected Overridable Sub ValidateName (component As IComponent, name As String)

Parameters

component
IComponent

The named component.

name
String

The component name to validate.

Attributes

Exceptions

component is null.

name is not unique.

Remarks

The ValidateName method is called by the Add method to determine if the name of the component being added is unique for this Container. If the name parameter is not null and is not unique, an ArgumentException is thrown.

Applies to

See also