SoapServices.RegisterInteropXmlType(String, String, Type) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将给定 XML 类型名称和命名空间与应该用于反序列化的运行时类型关联。
public:
static void RegisterInteropXmlType(System::String ^ xmlType, System::String ^ xmlTypeNamespace, Type ^ type);
public static void RegisterInteropXmlType (string xmlType, string xmlTypeNamespace, Type type);
[System.Security.SecurityCritical]
public static void RegisterInteropXmlType (string xmlType, string xmlTypeNamespace, Type type);
static member RegisterInteropXmlType : string * string * Type -> unit
[<System.Security.SecurityCritical>]
static member RegisterInteropXmlType : string * string * Type -> unit
Public Shared Sub RegisterInteropXmlType (xmlType As String, xmlTypeNamespace As String, type As Type)
参数
- xmlType
- String
在反序列化中使用的 XML 类型。
- xmlTypeNamespace
- String
在反序列化中使用的 XML 命名空间。
- 属性
例外
直接调用方没有基础结构权限。
示例
下面的代码示例演示如何使用此方法。 此代码示例是为 SoapServices 类提供的一个更大示例的一部分。
// Get the currently registered type for the given XML element
// and namespace.
String^ registeredXmlTypeName = L"ExampleXmlTypeName";
String^ registeredXmlTypeNamespace =
L"http://example.org/ExampleXmlTypeNamespace";
registeredType = SoapServices::GetInteropTypeFromXmlType(
registeredXmlTypeName, registeredXmlTypeNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
registeredType );
// Register a new type for the XML element and namespace.
SoapServices::RegisterInteropXmlType( registeredXmlTypeName,
registeredXmlTypeNamespace,String::typeid );
// Get the currently registered type for the given XML element
// and namespace.
registeredType = SoapServices::GetInteropTypeFromXmlType(
registeredXmlTypeName,registeredXmlTypeNamespace );
Console::WriteLine( L"The registered interop type is {0}.",
registeredType );
// Get the currently registered type for the given XML element
// and namespace.
string registeredXmlTypeName =
"ExampleXmlTypeName";
string registeredXmlTypeNamespace =
"http://example.org/ExampleXmlTypeNamespace";
registeredType =
SoapServices.GetInteropTypeFromXmlType(
registeredXmlTypeName,
registeredXmlTypeNamespace);
Console.WriteLine(
"The registered interop type is {0}.",
registeredType);
// Register a new type for the XML element and namespace.
SoapServices.RegisterInteropXmlType(
registeredXmlTypeName,
registeredXmlTypeNamespace,
typeof(String));
// Get the currently registered type for the given XML element
// and namespace.
registeredType =
SoapServices.GetInteropTypeFromXmlType(
registeredXmlTypeName,
registeredXmlTypeNamespace);
Console.WriteLine(
"The registered interop type is {0}.",
registeredType);