Partager via


XmlBinaryWriterSession.TryAdd Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Tries to add an XmlDictionaryString to the internal collection.

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

Syntax

'Declaration
Public Overridable Function TryAdd ( _
    value As XmlDictionaryString, _
    <OutAttribute> ByRef key As Integer _
) As Boolean
public virtual bool TryAdd(
    XmlDictionaryString value,
    out int key
)

Parameters

  • key
    Type: System.Int32%
    The key of the XmlDictionaryString that was successfully added.

Return Value

Type: System.Boolean
true , unless an exception was thrown.

Exceptions

Exception Condition
ArgumentNullException

value is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

An entry with key = key already exists.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.