XmlBinaryWriterSession.TryAdd Method (XmlDictionaryString, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Tries to add an XmlDictionaryString to the internal collection.

Namespace:   System.Xml
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

public virtual bool TryAdd(
	XmlDictionaryString value,
	out int key


Type: System.Xml.XmlDictionaryString

The XmlDictionaryString to add.

Type: System.Int32

The key of the XmlDictionaryString that was successfully added.

Return Value

Type: System.Boolean

true if the string could be added; otherwise, false.

Exception Condition

value is null.


An entry with key = key already exists.

When you use this class you must override this method to send the collection of keys along with the message. Without overriding, a new key is added to the collection, which is saved, but not sent with the message.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Available since 4.0
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top