Export (0) Print
Expand All

NameValueCollection.Add Method (NameValueCollection)

Copies the entries in the specified NameValueCollection to the current NameValueCollection.

Namespace: System.Collections.Specialized
Assembly: System (in system.dll)

public:
void Add (
	NameValueCollection^ c
)
public void Add (
	NameValueCollection c
)
public function Add (
	c : NameValueCollection
)
Not applicable.

Parameters

c

The NameValueCollection to copy to the current NameValueCollection.

Exception typeCondition

NotSupportedException

The collection is read-only.

ArgumentNullException

c is a null reference (Nothing in Visual Basic).

If a key in c already exists in the target NameValueCollection instance, the associated value in c is added to the existing comma-separated list of values associated with the same key in the target NameValueCollection instance.

If Count already equals the capacity, the capacity of the NameValueCollection is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

If Count is less than the capacity, this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2014 Microsoft