XmlSerializerFormatAttribute クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
XmlSerializer の代わりに XmlObjectSerializer を使用するようにWindows Communication Foundation (WCF) インフラストラクチャに指示します。
public ref class XmlSerializerFormatAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class XmlSerializerFormatAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type XmlSerializerFormatAttribute = class
inherit Attribute
Public NotInheritable Class XmlSerializerFormatAttribute
Inherits Attribute
- 継承
- 属性
例
次の例では、インターフェイスに XmlSerializerFormatAttribute を適用します。
[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);
}
<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
注釈
この属性は、 DataContractFormatAttribute 属性に似ています。 どちらの属性も、メソッド、クラス、またはインターフェイスに適用できます。
XmlSerializerの詳細については、「XmlSerializer クラスの使用」を参照してください。
メソッドには、2 つの属性のいずれかを適用できますが、両方を適用することはできません。 どちらも適用されていない操作では、包含クラスに適用された属性が使用されます。 包含クラスにどちらの属性も適用されていない場合は、 DataContractSerializer が使用されます。
属性を適用すると、実行時に XmlSerializerOperationBehavior も作成されます。 この動作により、シリアライザーの動作の実行時にカスタマイズが可能になります。
コンストラクター
| 名前 | 説明 |
|---|---|
| XmlSerializerFormatAttribute() |
XmlSerializerFormatAttribute クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Style |
XmlSerializerの SOAP スタイルを取得または設定します。 |
| SupportFaults |
エラーの読み取りと書き込みに XmlSerializer を使用する必要があることを示す値を取得または設定します。 |
| TypeId |
派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。 (継承元 Attribute) |
| Use |
使用する形式を指定する値を取得または設定します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| GetHashCode() |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IsDefaultAttribute() |
派生クラスでオーバーライドされた場合、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
| Match(Object) |
派生クラスでオーバーライドされた場合、このインスタンスが指定したオブジェクトと等しいかどうかを示す値を返します。 (継承元 Attribute) |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| 名前 | 説明 |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
インターフェイスの型情報を取得するために使用できるオブジェクトの型情報を取得します。 (継承元 Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
オブジェクトによって公開されるプロパティとメソッドへのアクセスを提供します。 (継承元 Attribute) |