SoapServices.GetInteropFieldTypeAndNameFromXmlAttribute メソッド

定義

XML 属性名、名前空間、および格納オブジェクトの Type からフィールド型を取得します。

public:
 static void GetInteropFieldTypeAndNameFromXmlAttribute(Type ^ containingType, System::String ^ xmlAttribute, System::String ^ xmlNamespace, [Runtime::InteropServices::Out] Type ^ % type, [Runtime::InteropServices::Out] System::String ^ % name);
public static void GetInteropFieldTypeAndNameFromXmlAttribute(Type containingType, string xmlAttribute, string xmlNamespace, out Type type, out string name);
static member GetInteropFieldTypeAndNameFromXmlAttribute : Type * string * string * Type * string -> unit
Public Shared Sub GetInteropFieldTypeAndNameFromXmlAttribute (containingType As Type, xmlAttribute As String, xmlNamespace As String, ByRef type As Type, ByRef name As String)

パラメーター

containingType
Type

フィールドを含むオブジェクトの Type

xmlAttribute
String

フィールド型の XML 属性名。

xmlNamespace
String

フィールド型の XML 名前空間。

type
Type

このメソッドから制御が戻るときに、フィールドの Type が格納されます。 このパラメーターは初期化せずに渡されます。

name
String

このメソッドから制御が戻るときに、フィールドの名前を保持する String が格納されます。 このパラメーターは初期化せずに渡されます。

例外

直前の呼び出し元にはインフラストラクチャアクセス許可がありません。

次のコード例は、このメソッドの使用方法を示しています。 このコード例は、 SoapServices クラスに提供されるより大きな例の一部です。

// Get the name and the type of the field using its XML
// element name and its XML namespace. For this query to work,
// the containing type must be preloaded, and the XML element
// name and the XML namespace must be explicitly declared on
// the field using a SoapFieldAttribute.
// Preload the containing type.
SoapServices::PreLoad( ExampleNamespace::ExampleClass::typeid );

// Get the name and the type of a field that will be
// serialized as an XML element.
Type^ containingType = ExampleNamespace::ExampleClass::typeid;
String^ xmlElementNamespace = L"http://example.org/ExampleFieldNamespace";
String^ xmlElementName = L"ExampleFieldElementName";
Type^ fieldType;
String^ fieldName;
SoapServices::GetInteropFieldTypeAndNameFromXmlElement(
   containingType,xmlElementName,xmlElementNamespace,fieldType,fieldName );
Console::WriteLine( L"The type of the field is {0}.", fieldType );
Console::WriteLine( L"The name of the field is {0}.", fieldName );

// Get the name and the type of a field that will be
// serialized as an XML attribute.
String^ xmlAttributeNamespace =
   L"http://example.org/ExampleAttributeNamespace";
String^ xmlAttributeName = L"ExampleFieldAttributeName";
SoapServices::GetInteropFieldTypeAndNameFromXmlAttribute(
   containingType,xmlAttributeName,xmlAttributeNamespace,fieldType,fieldName );
Console::WriteLine( L"The type of the field is {0}.", fieldType );
Console::WriteLine( L"The name of the field is {0}.", fieldName );
// Get the name and the type of the field using its XML 
// element name and its XML namespace. For this query to work,
// the containing type must be preloaded, and the XML element 
// name and the XML namespace must be explicitly declared on 
// the field using a SoapFieldAttribute.

// Preload the containing type.
SoapServices.PreLoad(typeof(ExampleNamespace.ExampleClass));

// Get the name and the type of a field that will be 
// serialized as an XML element.
Type containingType = typeof(ExampleNamespace.ExampleClass);
string xmlElementNamespace = 
    "http://example.org/ExampleFieldNamespace";
string xmlElementName = "ExampleFieldElementName";
Type fieldType;
string fieldName;
SoapServices.GetInteropFieldTypeAndNameFromXmlElement(
    containingType, xmlElementName, xmlElementNamespace, 
    out fieldType, out fieldName);
Console.WriteLine(
    "The type of the field is {0}.",
    fieldType);
Console.WriteLine(
    "The name of the field is {0}.",
    fieldName);

// Get the name and the type of a field that will be 
// serialized as an XML attribute.
string xmlAttributeNamespace = 
    "http://example.org/ExampleAttributeNamespace";
string xmlAttributeName = "ExampleFieldAttributeName";
SoapServices.GetInteropFieldTypeAndNameFromXmlAttribute(
    containingType, xmlAttributeName, xmlAttributeNamespace, 
    out fieldType, out fieldName);
Console.WriteLine(
    "The type of the field is {0}.",
    fieldType);
Console.WriteLine(
    "The name of the field is {0}.",
    fieldName);

注釈

.NET Framework によって読み取られる包含オブジェクトの型と XML 属性と XML 名前空間を指定すると、現在のメソッドは、フィールドの実際の共通言語ランタイム フィールド名と型を返します。 その後、.NET Framework はこの情報を使用して、XML ストリームから読み取られたデータをそのフィールドに設定します。

適用対象