Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

XmlSerializerAssemblyAttribute Class

Note: This class is new in the .NET Framework version 2.0.

Applied to a Web service client proxy, enables you to specify an assembly that contains custom-made serializers.

Namespace: System.Xml.Serialization
Assembly: System.Xml (in system.xml.dll)

[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false)] 
public sealed class XmlSerializerAssemblyAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false) */ 
public final class XmlSerializerAssemblyAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple=false) 
public final class XmlSerializerAssemblyAttribute extends Attribute

Use the XmlSerializerAssemblyAttribute to increase the performance of a Web service client application.

A typical method of using this attribute is as follows:

  1. Create a client proxy for a Web service.

  2. Open the machine.config file.

  3. Under the system.diagnostics element, add a value under the <switches> element to keep the compiled files:

    <system.diagnostics>
       <switches>
          <add name="XmlSerialization.Compilation" value="4"/>
       </switches>
    </system.diagnostics>
    
  4. Compile the proxy.

  5. Run the proxy application.

  6. Open a command window and navigate to the \Temp directory used by the XmlSerializer to cache files.

    cd %temp%
    
  7. Find the last file created using the dir command with the /OD switch.

    dir *.vb /OD 
    
  8. Compile the file into an assembly. Name the assembly.

  9. Edit the original proxy code by applying the XmlSerializerAssemblyAttribute to the class. Specify the assembly name, as shown in the following C# code.

    [XmlSerializerAssemblyAttribute(AssemblyName="hello.serializer")]
    public class Hello: System.Web.Services.Protocols.SoapHttpClientProtocol {
       // Proxy code not shown.
    }
    
<XmlSerializerAssemblyAttribute(AssemblyName:="hello.serializer")> _
Public Class Hello
Implements System.Web.Services.Protocols.SoapHttpClientProtocol 
   ' Proxy code not shown.
End Class
System.Object
   System.Attribute
    System.Xml.Serialization.XmlSerializerAssemblyAttribute
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 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.