DataContractFormatAttribute クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
DataContractSerializer を使用するように Windows Communication Foundation (WCF) インフラストラクチャに指示します。
public ref class DataContractFormatAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class DataContractFormatAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, Inherited=false)]
public sealed class DataContractFormatAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type DataContractFormatAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Method, Inherited=false)>]
type DataContractFormatAttribute = class
inherit Attribute
Public NotInheritable Class DataContractFormatAttribute
Inherits Attribute
- 継承
- 属性
DataContractFormatAttribute を適用し、Style プロパティを Rpc に設定する例を次に示します。 RPC スタイルは、Web サービス記述言語 (WSDL) で記述されます。
[ServiceContract, DataContractFormat(Style = OperationFormatStyle.Rpc)]
interface ICalculator
{
[OperationContract, DataContractFormat(Style = OperationFormatStyle.Rpc)]
double Add(double a, double b);
[OperationContract, DataContractFormat(Style = OperationFormatStyle.Document)]
double Subtract(double a, double b);
}
<ServiceContract(), DataContractFormat(Style := OperationFormatStyle.Rpc)> _
Interface ICalculator
<OperationContract(), DataContractFormat(Style := OperationFormatStyle.Rpc)> _
Function Add(ByVal a As Double, ByVal b As Double) As Double
<OperationContract(), DataContractFormat(Style := OperationFormatStyle.Document)> _
Function Subtract(ByVal a As Double, ByVal b As Double) As Double
End Interface
<ServiceContract(), DataContractFormat(Style := OperationFormatStyle.Rpc)> _
Interface ICalculator
<OperationContract(), DataContractFormat(Style := OperationFormatStyle.Rpc)> _
Function Add(ByVal a As Double, ByVal b As Double) As Double
<OperationContract(), DataContractFormat(Style := OperationFormatStyle.Document)> _
Function Subtract(ByVal a As Double, ByVal b As Double) As Double
End Interface
この属性は、XmlSerializerFormatAttribute 属性に似ています。 どちらの属性も、メソッドまたはクラスに適用できます。
メソッドには、2 つの属性のいずれかを適用でき、両方は適用できません。 どちらの属性も適用されていない操作では、格納クラスに適用された属性を使用します。 格納クラスにどちらの属性も適用されていない場合は、DataContractSerializer が使用されます。
属性を適用すると、実行時に DataContractSerializerOperationBehavior が作成されます。 この動作は、シリアライザーの実行時の動作のカスタマイズを可能にします。
Data |
DataContractFormatAttribute クラスの新しいインスタンスを初期化します。 |
Style |
シリアル化されたデータの SOAP スタイルを取得または設定します。 |
Type |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。 (継承元 Attribute) |
Equals(Object) |
このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。 (継承元 Attribute) |
Get |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Is |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
_Attribute. |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
_Attribute. |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
_Attribute. |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
_Attribute. |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
UWP | 10.0 |