System.ServiceModel 名前空間


.NET Framework クラス ライブラリ
XmlSerializerFormatAttribute クラス

更新 : 2007 年 11 月

Windows Communication Foundation (WCF) インフラストラクチャに対して、XmlObjectSerializer の代わりに XmlSerializer を使用するように指示します。

名前空間 :  System.ServiceModel
アセンブリ :  System.ServiceModel (System.ServiceModel.dll 内)
構文

Visual Basic (宣言)
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Method Or AttributeTargets.Interface, Inherited := False,  _
    AllowMultiple := False)> _
Public NotInheritable Class XmlSerializerFormatAttribute _
    Inherits Attribute
Visual Basic (使用法)
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
J#
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Interface, Inherited = false, AllowMultiple = false) */
public final class XmlSerializerFormatAttribute extends Attribute
JScript
public final class XmlSerializerFormatAttribute extends Attribute
解説

この属性は、DataContractFormatAttribute 属性に似ています。どちらの属性も、メソッド、クラス、またはインターフェイスに適用できます。

XmlSerializerの詳細については、「XmlSerializer クラスの使用」を参照してください。

メソッドには、2 つの属性のいずれかを適用でき、両方は適用できません。どちらの属性も適用されていない操作では、格納クラスに適用された属性を使用します。格納クラスにどちらの属性も適用されていない場合は、DataContractSerializer が使用されます。

属性を適用すると、実行時に XmlSerializerOperationBehavior が作成されます。この動作により、シリアライザの動作を実行時にカスタマイズできるようになります。


次の例では、XmlSerializerFormatAttribute をインターフェイスに適用します。

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
スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報

.NET Framework

サポート対象 : 3.5、3.0
参照

参照

その他の技術情報

タグ :


Page view tracker