XmlSerializerAssemblyAttribute 類別

定義

套用至 Web 服務用戶端 Proxy,可讓您指定包含自定義串行化程式的元件。

public ref class XmlSerializerAssemblyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, AllowMultiple=false)]
public sealed class XmlSerializerAssemblyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, AllowMultiple=false)>]
type XmlSerializerAssemblyAttribute = class
    inherit Attribute
Public NotInheritable Class XmlSerializerAssemblyAttribute
Inherits Attribute
繼承
XmlSerializerAssemblyAttribute
屬性

備註

使用 來 XmlSerializerAssemblyAttribute 提升 Web 服務客戶端應用程式的效能。

使用此屬性的典型方法如下:

  1. 建立一個 Web 服務的客戶端代理。

  2. 打開 machine.config 檔案。

  3. 在 system.diagnostics 元素下,加入 <switches> 一個值以保留已編譯的檔案:

    <system.diagnostics>  
       <switches>  
          <add name="XmlSerialization.Compilation" value="4"/>  
       </switches>  
    </system.diagnostics>  
    
  4. 編譯代理伺服器。

  5. 執行代理應用程式。

  6. 打開指令視窗,並切換到 快取檔案所用 XmlSerializer 的 \Temp 目錄。

    cd %temp%  
    
  7. /OD 開關找到用 dir 指令建立的最後一個檔案。

    dir *.vb /OD   
    
  8. 將檔案編譯成組件。 說出議會名稱。

  9. 將原始代理程式碼套用 XmlSerializerAssemblyAttribute 到類別中來編輯。 請指定組合名稱,如以下 C# 程式碼所示。

    [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  

建構函式

名稱 Description
XmlSerializerAssemblyAttribute()

初始化 XmlSerializerAssemblyAttribute 類別的新執行個體。

XmlSerializerAssemblyAttribute(String, String)

初始化一個以指定的組合語言名稱和組裝地點的新類別實例 XmlSerializerAssemblyAttribute

XmlSerializerAssemblyAttribute(String)

初始化一個以指定組合名稱的 XmlSerializerAssemblyAttribute 類別實例。

屬性

名稱 Description
AssemblyName

取得或設定包含特定類型序列化器的組合名稱。

CodeBase

取得或設定包含序列化器的組裝裝置位置。

TypeId

在衍生類別中實作時,取得這個 Attribute的唯一標識碼。

(繼承來源 Attribute)

方法

名稱 Description
Equals(Object)

傳回值,這個值表示這個實例是否等於指定的物件。

(繼承來源 Attribute)
GetHashCode()

傳回這個實例的哈希碼。

(繼承來源 Attribute)
GetType()

取得目前實例的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,指出這個實例的值是否為衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

明確介面實作

名稱 Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取 物件的型別資訊,可用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開屬性和方法的存取權。

(繼承來源 Attribute)

適用於