Export (0) Print
Expand All

XamlObjectWriter.WriteNamespace Method

Defines a namespace declaration that applies to the next object scope or member scope.

Namespace:  System.Xaml
Assembly:  System.Xaml (in System.Xaml.dll)

public override void WriteNamespace(
	NamespaceDeclaration namespaceDeclaration
)

Parameters

namespaceDeclaration
Type: System.Xaml.NamespaceDeclaration

The namespace declaration to write.

ExceptionCondition
ArgumentNullException

The namespaceDeclaration is null.

ArgumentException

A component of namespaceDeclaration is null.

XamlObjectReaderException

Tried to write a XAML namespace node in an invalid scope.

A namespace declaration can be written if the current scope is a root scope, object scope, or member scope. However, WriteNamespace can only be called immediately before a call to one of the following: WriteNamespace, WriteStartObject, or WriteStartMember. The consecutive WriteNamespace case is for writing multiple namespace declarations to the same node. Eventually, either WriteStartObject or WriteStartMember must be called.

WriteNamespace does not use a Start/End metaphor. Although a XAML namespace has members in the CLR representation sense, the members are known and do not need to be represented as a special type of XamlMember for extensibility. To access the values of a NamespaceDeclaration, you access its Namespace and Prefix properties.

A namespace declaration may have a String.Empty value for the prefix. A String.Empty prefix represents a declaration of the default XAML namespace. Do not attempt to use null to represent the default prefix; it throws an exception in this API. For more information, see NamespaceDeclaration.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft