Partage via


TagPrefixCollection.Add(TagPrefixInfo) Méthode

Définition

Ajoute un objet TagPrefixInfo à la collection.

public:
 void Add(System::Web::Configuration::TagPrefixInfo ^ tagPrefixInformation);
public void Add (System.Web.Configuration.TagPrefixInfo tagPrefixInformation);
member this.Add : System.Web.Configuration.TagPrefixInfo -> unit
Public Sub Add (tagPrefixInformation As TagPrefixInfo)

Paramètres

tagPrefixInformation
TagPrefixInfo

Objet TagPrefixInfo à ajouter à la collection.

Exceptions

L’objet TagPrefixInfo à ajouter existe déjà dans la collection.

  • ou - La collection est en lecture seule.

Exemples

L'exemple de code suivant montre comment utiliser la méthode Add. Cet exemple de code fait partie d’un exemple plus grand fourni pour la PagesSection classe.

// Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add(
    new System.Web.Configuration.TagPrefixInfo(
    "MyCtrl", "MyNameSpace", "MyAssembly", "MyControl",
    "MyControl.ascx"));
' Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add( _
 New System.Web.Configuration.TagPrefixInfo( _
 "MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", _
 "MyControl.ascx"))

Remarques

La collection ne doit pas déjà contenir d’objet TagPrefixInfo avec les mêmes valeurs de propriété. Si c’est le cas, un ConfigurationException sera jeté.

S’applique à

Voir aussi