CSharpTest.Net
UserSettingsSubSectionCollection Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.AppConfig Namespace : UserSettingsSubSectionCollection Class

Glossary Item Box

Provides a collection of name keyed sections that contain more key/value settings

Object Model

UserSettingsSubSectionCollection ClassUserSettingsSubSection Class

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class UserSettingsSubSectionCollection 
   Inherits System.Configuration.ConfigurationElementCollection
C# 
public sealed class UserSettingsSubSectionCollection : System.Configuration.ConfigurationElementCollection 

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.NETCopy 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

System.Object
   System.Configuration.ConfigurationElement
      System.Configuration.ConfigurationElementCollection
         CSharpTest.Net.AppConfig.UserSettingsSubSectionCollection

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys