Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

NameValueCollection.Set Method

Sets the value of an entry in the NameValueCollection.

[Visual Basic]
Public Overridable Sub Set( _
   ByVal name As String, _
   ByVal value As String _
)
[C#]
public virtual void Set(
 string name,
 string value
);
[C++]
public: virtual void Set(
 String* name,
 String* value
);
[JScript]
public function Set(
   name : String,
 value : String
);

Parameters

name
The String key of the entry to add the new value to. The key can be a null reference (Nothing in Visual Basic).
value
The Object that represents the new value to add to the specified entry. The value can be a null reference (Nothing in Visual Basic).

Exceptions

Exception Type Condition
NotSupportedException The collection is read-only.

Remarks

If the specified key already exists in the collection, this method overwrites the existing list of values with the specified value. To append the new value to the existing list of values, use the Add method.

If the specified key does not exist in the collection, this method creates a new entry using the specified key and the specified value.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

NameValueCollection Class | NameValueCollection Members | System.Collections.Specialized Namespace | Add | Performing Culture-Insensitive String Operations

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.