Freigeben über


SoapServices.GetXmlTypeForInteropType-Methode

Gibt Informationen über den XML-Typ zurück, die bei der Serialisierung des angegebenen Type verwendet werden.

Namespace: System.Runtime.Remoting
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function GetXmlTypeForInteropType ( _
    type As Type, _
    <OutAttribute> ByRef xmlType As String, _
    <OutAttribute> ByRef xmlTypeNamespace As String _
) As Boolean
'Usage
Dim type As Type
Dim xmlType As String
Dim xmlTypeNamespace As String
Dim returnValue As Boolean

returnValue = SoapServices.GetXmlTypeForInteropType(type, xmlType, xmlTypeNamespace)
public static bool GetXmlTypeForInteropType (
    Type type,
    out string xmlType,
    out string xmlTypeNamespace
)
public:
static bool GetXmlTypeForInteropType (
    Type^ type, 
    [OutAttribute] String^% xmlType, 
    [OutAttribute] String^% xmlTypeNamespace
)
public static boolean GetXmlTypeForInteropType (
    Type type, 
    /** @attribute OutAttribute() */ /** @ref */ String xmlType, 
    /** @attribute OutAttribute() */ /** @ref */ String xmlTypeNamespace
)
JScript unterstützt die Übergabe von Werttypargumenten als Verweis nicht.

Parameter

  • type
    Der Objekt-Type, für den die Namen des XML-Elements und -Namespaces angefordert wurden.
  • xmlType
    Der XML-Typ des angegebenen Objekt-Type.
  • xmlTypeNamespace
    Der XML-Typnamespace für den angegebenen Objekt-Type.

Rückgabewert

true, wenn die angeforderten Werte beim Festlegen mit SoapTypeAttribute gekennzeichnet wurden, andernfalls false.

Ausnahmen

Ausnahmetyp Bedingung

SecurityException

Der direkte Aufrufer verfügt nicht über die Berechtigung für die Infrastruktur.

Beispiel

Im folgenden Codebeispiel wird die Verwendung dieser Methode veranschaulicht. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die SoapServices-Klasse.

// 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);
// 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(
    ExampleNamespace.ExampleClass.class.ToType(), xmlTypeName, 
    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);

.NET Framework-Sicherheit

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

SoapServices-Klasse
SoapServices-Member
System.Runtime.Remoting-Namespace
GetInteropFieldTypeAndNameFromXmlElement