Share via


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

Définition

Retourne des informations sur l'élément XML à utiliser pour la sérialisation du type donné.

public:
 static bool GetXmlElementForInteropType(Type ^ type, [Runtime::InteropServices::Out] System::String ^ % xmlElement, [Runtime::InteropServices::Out] System::String ^ % xmlNamespace);
public static bool GetXmlElementForInteropType (Type type, out string xmlElement, out string xmlNamespace);
[System.Security.SecurityCritical]
public static bool GetXmlElementForInteropType (Type type, out string xmlElement, out string xmlNamespace);
static member GetXmlElementForInteropType : Type * string * string -> bool
[<System.Security.SecurityCritical>]
static member GetXmlElementForInteropType : Type * string * string -> bool
Public Shared Function GetXmlElementForInteropType (type As Type, ByRef xmlElement As String, ByRef xmlNamespace 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.

xmlElement
String

Lorsque cette méthode est retournée, contient un String contenant le nom d'élément XML du type d'objet spécifié. Ce paramètre est passé sans être initialisé.

xmlNamespace
String

Lorsque cette méthode est retournée, contient un String contenant le nom d'espace de noms XML du type d'objet spécifié. Ce paramètre est passé sans être initialisé.

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 element name and the XML namespace for
// an Interop type.
String^ xmlElement;
bool isSoapTypeAttribute = SoapServices::GetXmlElementForInteropType(
   ExampleNamespace::ExampleClass::typeid,xmlElement,xmlNamespace );

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

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

S’applique à

Voir aussi