SoapServices.GetXmlElementForInteropType(Type, String, String) メソッド

定義

特定の型をシリアル化するときに使用する XML 要素情報を返します。

public:
 static bool GetXmlElementForInteropType(Type ^ type, [Runtime::InteropServices::Out] System::String ^ % xmlElement, [Runtime::InteropServices::Out] System::String ^ % xmlNamespace);
public static bool GetXmlElementForInteropType (Type type, out string xmlElement, out string xmlNamespace);
[System.Security.SecurityCritical]
public static bool GetXmlElementForInteropType (Type type, out string xmlElement, out string xmlNamespace);
static member GetXmlElementForInteropType : Type * string * string -> bool
[<System.Security.SecurityCritical>]
static member GetXmlElementForInteropType : Type * string * string -> bool
Public Shared Function GetXmlElementForInteropType (type As Type, ByRef xmlElement As String, ByRef xmlNamespace As String) As Boolean

パラメーター

type
Type

XML 要素と名前空間の名前を要求したオブジェクト Type

xmlElement
String

このメソッドが返されるときに、指定したオブジェクト型の XML 要素名を保持している String を格納します。 このパラメーターは初期化せずに渡されます。

xmlNamespace
String

このメソッドが返されるときに、指定したオブジェクト型の XML 名前空間の名前を保持している String を格納します。 このパラメーターは初期化せずに渡されます。

戻り値

要求した値に SoapTypeAttribute のフラグが設定されている場合は true。それ以外の場合は false

属性

例外

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

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

// Get the XML element name and the XML namespace for
// an Interop type.
String^ xmlElement;
bool isSoapTypeAttribute = SoapServices::GetXmlElementForInteropType(
   ExampleNamespace::ExampleClass::typeid,xmlElement,xmlNamespace );

// Print whether the requested value was flagged
// with a SoapTypeAttribute.
if ( isSoapTypeAttribute )
{
   Console::WriteLine( L"The requested value was flagged "
   L"with the SoapTypeAttribute." );
}
else
{
   Console::WriteLine( L"The requested value was not flagged "
   L"with the SoapTypeAttribute." );
}

// Print the XML element and the XML namespace.
Console::WriteLine( L"The XML element for the type "
L"ExampleNamespace.ExampleClass is {0}.", xmlElement );
Console::WriteLine( L"The XML namespace for the type "
L"ExampleNamespace.ExampleClass is {0}.", xmlNamespace );
// Get the XML element name and the XML namespace for 
// an Interop type.
string xmlElement;
bool isSoapTypeAttribute =
    SoapServices.GetXmlElementForInteropType(
    typeof(ExampleNamespace.ExampleClass), 
    out xmlElement, out xmlNamespace);

// Print whether the requested value was flagged 
// with a SoapTypeAttribute.
if (isSoapTypeAttribute)
{
    Console.WriteLine(
        "The requested value was flagged " +
        "with the SoapTypeAttribute.");
}
else 
{
    Console.WriteLine(
        "The requested value was not flagged " +
        "with the SoapTypeAttribute.");
}

// Print the XML element and the XML namespace.
Console.WriteLine(
    "The XML element for the type " +
    "ExampleNamespace.ExampleClass is {0}.",
    xmlElement);
Console.WriteLine(
    "The XML namespace for the type " +
    "ExampleNamespace.ExampleClass is {0}.",
    xmlNamespace);

適用対象

こちらもご覧ください