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

name

Glossary Item Box

Removes the specified collection by name

Syntax

Visual Basic (Declaration) 
Public Sub Remove( _
   ByVal name As String _
) 
C# 
public void Remove( 
   string name
)

Parameters

name

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)

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys