Provides a collection of name keyed sections that contain more key/value settings
Object Model
Syntax
Example
Library/Library.Test/TestUserSettings.cs
C# | Copy Code |
---|
UserSettingsSubSection a;
UserSettingsSubSectionCollection coll1 = new UserSettingsSubSectionCollection();
Assert.AreEqual(ConfigurationElementCollectionType.AddRemoveClearMap, coll1.CollectionType);
Assert.IsNull(coll1["a"]);
a = coll1.Add("a");
Assert.AreEqual(a, coll1["a"]);
coll1.Remove("a");
Assert.IsNull(coll1["a"]);
a = coll1.Add("a");
Assert.AreEqual(a, coll1["a"]);
coll1.Clear();
Assert.IsNull(coll1["a"]);
a = coll1.Add("a");
Assert.AreEqual(a, coll1["a"]);
UserSettingsSubSectionCollection other = new UserSettingsSubSectionCollection();
other.CopyFrom(coll1);
Assert.IsNotNull(other["a"]);
Assert.AreEqual("a", other["a"].Name); |
VB.NET | Copy Code |
---|
Dim a As UserSettingsSubSection
Dim coll1 As New UserSettingsSubSectionCollection()
Assert.AreEqual(ConfigurationElementCollectionType.AddRemoveClearMap, coll1.CollectionType)
Assert.IsNull(coll1("a"))
a = coll1.Add("a")
Assert.AreEqual(a, coll1("a"))
coll1.Remove("a")
Assert.IsNull(coll1("a"))
a = coll1.Add("a")
Assert.AreEqual(a, coll1("a"))
coll1.Clear()
Assert.IsNull(coll1("a"))
a = coll1.Add("a")
Assert.AreEqual(a, coll1("a"))
Dim other As New UserSettingsSubSectionCollection()
other.CopyFrom(coll1)
Assert.IsNotNull(other("a"))
Assert.AreEqual("a", other("a").Name) |
Inheritance Hierarchy
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also