ProfilePropertySettingsCollection.Add(ProfilePropertySettings) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
新增一個 ProfilePropertySettings 物件到集合中。
public:
void Add(System::Web::Configuration::ProfilePropertySettings ^ propertySettings);
public void Add(System.Web.Configuration.ProfilePropertySettings propertySettings);
member this.Add : System.Web.Configuration.ProfilePropertySettings -> unit
Public Sub Add (propertySettings As ProfilePropertySettings)
參數
- propertySettings
- ProfilePropertySettings
一個 ProfilePropertySettings 要加入收藏的物件。
例外狀況
ProfilePropertySettings要新增的物件已經存在於集合中,或是集合是唯讀的。
範例
下列程式代碼範例示範如何使用 Add 方法。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。
// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";
newPropGroup.PropertySettings.Add(newProp);
' Add a new PropertySettings to the group.
Dim newProp As ProfilePropertySettings = new ProfilePropertySettings("AvatarImage")
newProp.Type = "System.String, System.dll"
newPropGroup.PropertySettings.Add(newProp)
備註
該集合必須不包含 ProfilePropertySettings 同名的物件。