ContractNamespaceAttribute クラス

定義

データ コントラクトの CLR 名前空間と XML 名前空間を指定します。

public ref class ContractNamespaceAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module, AllowMultiple=true, Inherited=false)]
public sealed class ContractNamespaceAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module, AllowMultiple=true, Inherited=false)>]
type ContractNamespaceAttribute = class
    inherit Attribute
Public NotInheritable Class ContractNamespaceAttribute
Inherits Attribute
継承
ContractNamespaceAttribute
属性

アセンブリに適用された ContractNamespaceAttribute の例を次に示します。

[assembly: ContractNamespaceAttribute("http://www.cohowinery.com/employees",
    ClrNamespace = "Microsoft.Contracts.Examples")]
namespace Microsoft.Contracts.Examples
{
    [DataContract]
    public class Person
    {
        [DataMember]
        internal string FirstName;
        [DataMember]
        internal string LastName;
    }
}
<assembly: ContractNamespaceAttribute("http://www.cohowinery.com/employees", _
   ClrNamespace := "Microsoft.Contracts.Examples")>

Namespace Microsoft.Contracts.Examples
    <DataContract()>  _
    Public Class Person
        <DataMember()>  _
        Friend FirstName As String
        <DataMember()>  _
        Friend LastName As String
    End Class 
End Namespace

注釈

ContractNamespaceAttribute 属性は、DataContractAttribute が適用されている型を含むアセンブリに適用します。 ContractNamespaceAttribute を使用して、型がシリアル化されたときに生成される名前空間とは異なる名前空間を設定できます。 名前の生成方法の詳細については、「 データ コントラクト名」を参照してください。

既存のデータ コントラクトに適合する型を使用する場合は、ContractNamespaceAttribute (または Namespace クラスの DataContractAttribute プロパティ) を使用することで、既存のコントラクトの名前空間と一致させる必要があります。

Note

コードでは、ContractNamespace の代わりに ContractNamespaceAttribute という短い語を使用できます。

コンストラクター

ContractNamespaceAttribute(String)

指定した名前空間を使用して、ContractNamespaceAttribute クラスの新しいインスタンスを初期化します。

プロパティ

ClrNamespace

データ コントラクト型の CLR 名前空間を取得または設定します。

ContractNamespace

データ コントラクト メンバーの名前空間を取得します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

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)

適用対象

こちらもご覧ください