Share via


SoapServices.GetXmlTypeForInteropType(Type, String, String) Méthode

Définition

Retourne des informations de type XML à utiliser pour la sérialisation du Type donné.

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

Paramètres

type
Type

Type d'objets pour lequel les noms d'élément et d'espaces de noms XML ont été demandés.

xmlType
String

Type XML du Type d'objets spécifié.

xmlTypeNamespace
String

Espace de noms du type XML du Type d'objets spécifié.

Retours

true si les valeurs demandées ont été marquées à l'aide de SoapTypeAttribute ; sinon false.

Attributs

Exceptions

L'appelant immédiat n'a pas d'autorisation d'accès à l'infrastructure.

Exemples

L'exemple de code suivant montre comment utiliser cette méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la SoapServices classe .

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

S’applique à

Voir aussi