Click to Rate and Give Feedback

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
XmlSerializerFormatAttribute Class

Instructs the Windows Communication Foundation (WCF) infrastructure to use the XmlSerializer instead of the XmlObjectSerializer.

Namespace:  System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)
Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Interface, Inherited := False,  _
    AllowMultiple := False)> _
Public NotInheritable Class XmlSerializerFormatAttribute _
    Inherits Attribute
Visual Basic (Usage)
Dim instance As XmlSerializerFormatAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Interface, Inherited = false, 
    AllowMultiple = false)]
public sealed class XmlSerializerFormatAttribute : Attribute
Visual C++
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Method|AttributeTargets::Interface, Inherited = false, 
    AllowMultiple = false)]
public ref class XmlSerializerFormatAttribute sealed : public Attribute
JScript
public final class XmlSerializerFormatAttribute extends Attribute

This attribute is similar to the DataContractFormatAttribute attribute. Both attributes can be applied to a method, class, or interface.

For more information about the XmlSerializer, see Using the XmlSerializer.

A method can have either of the two attributes applied, but not both. Any operation that has neither applied uses the attribute applied to the containing class. If the containing class does not have either attribute applied, the DataContractSerializer is used.

Applying the attribute also causes a XmlSerializerOperationBehavior to be created at runtime. The behavior allows customization at runtime of the serializer behavior.

The following example applies the XmlSerializerFormatAttribute to an interface.

Visual Basic
<ServiceContract(), XmlSerializerFormat(Style := OperationFormatStyle.Rpc, _
   Use := OperationFormatUse.Encoded)>  _
Public Interface ICalculator
    <OperationContract(), XmlSerializerFormat(Style := OperationFormatStyle.Rpc, _
        Use := OperationFormatUse.Encoded)>  _
    Function Add(ByVal a As Double, ByVal b As Double) As Double 
End Interface 

C#
[ServiceContract, XmlSerializerFormat(Style = OperationFormatStyle.Rpc, 
    Use = OperationFormatUse.Encoded)]
public interface ICalculator
{
    [OperationContract, XmlSerializerFormat(Style = OperationFormatStyle.Rpc, 
        Use = OperationFormatUse.Encoded)]
    double Add(double a, double b);
}

System..::.Object
  System..::.Attribute
    System.ServiceModel..::.XmlSerializerFormatAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker