共用方式為


SoapServices.GetXmlTypeForInteropType(Type, String, String) 方法

定義

傳回 XML 型別資訊,應該在所指定 Type 序列化時使用。

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

參數

type
Type

對其要求 XML 項目和命名空間名稱的物件 Type

xmlType
String

所指定物件 Type 的 XML 型別。

xmlTypeNamespace
String

所指定物件 Type 的 XML 型別命名空間。

傳回

如果要求的值以 SoapTypeAttribute 設定旗標,則為 true,否則為 false

屬性

例外狀況

立即呼叫端沒有基礎結構使用權限。

範例

下列程式碼範例會顯示如何使用這個方法。 此程式代碼範例是提供給 類別之較大範例的 SoapServices 一部分。

// Get the XML type name and the XML type namespace for
// an Interop type.
String^ xmlTypeName;
String^ xmlTypeNamespace;
isSoapTypeAttribute = SoapServices::GetXmlTypeForInteropType( ExampleNamespace::ExampleClass::typeid,xmlTypeName,xmlTypeNamespace );

// 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 type name and the XML type namespace.
Console::WriteLine( L"The XML type for the type "
L"ExampleNamespace.ExampleClass is {0}.", xmlTypeName );
Console::WriteLine( L"The XML type namespace for the type "
L"ExampleNamespace.ExampleClass is {0}.", xmlTypeNamespace );
// Get the XML type name and the XML type namespace for 
// an Interop type.
string xmlTypeName;
string xmlTypeNamespace;
isSoapTypeAttribute =
    SoapServices.GetXmlTypeForInteropType(
    typeof(ExampleNamespace.ExampleClass), 
    out xmlTypeName, out xmlTypeNamespace);

// 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 type name and the XML type namespace.
Console.WriteLine(
    "The XML type for the type " +
    "ExampleNamespace.ExampleClass is {0}.",
    xmlTypeName);
Console.WriteLine(
    "The XML type namespace for the type " +
    "ExampleNamespace.ExampleClass is {0}.",
    xmlTypeNamespace);

適用於

另請參閱