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

定义

返回在序列化给定 Type 时应使用的 XML 类型信息。Returns XML type information that should be used when serializing the given 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 元素和命名空间名称的对象 TypeThe object Type for which the XML element and namespace names were requested.

xmlType
String

指定对象 Type 的 XML 类型。The XML type of the specified object Type.

xmlTypeNamespace
String

指定对象 Type 的 XML 类型命名空间。The XML type namespace of the specified object Type.

返回

Boolean

如果请求值已用 SoapTypeAttribute 设置了标志,则为 true;否则为 falsetrue if the requested values have been set flagged with SoapTypeAttribute; otherwise, false.

属性

例外

直接调用方没有基础结构权限。The immediate caller does not have infrastructure permission.

示例

下面的代码示例演示如何使用此方法。The following code example shows how to use this method. 此代码示例是为类提供的更大示例的一部分 SoapServicesThis code example is part of a larger example provided for the SoapServices class.

// 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);

适用于

另请参阅