SoapServices.GetXmlElementForInteropType(Type, String, String) Metodo

Definizione

Restituisce informazioni sugli elementi XML da utilizzare durante la serializzazione del tipo specificato.

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

Parametri

type
Type

Type dell'oggetto per il quale sono stati richiesti i nomi dello spazio dei nomi e dell'elemento XML.

xmlElement
String

Quando termina, questo metodo contiene un oggetto String con il nome dell'elemento XML del tipo di oggetto specificato. Questo parametro viene passato non inizializzato.

xmlNamespace
String

Quando termina, questo metodo contiene un oggetto String con il nome dello spazio dei nomi XML del tipo di oggetto specificato. Questo parametro viene passato non inizializzato.

Restituisce

true se ai valori richiesti sono stati assegnati dei flag SoapTypeAttribute; in caso contrario, false.

Attributi

Eccezioni

Il chiamante immediato non dispone dell'autorizzazione di infrastruttura.

Esempio

Nell'esempio di codice riportato di seguito viene illustrato come utilizzare questo metodo. Questo esempio di codice fa parte di un esempio più grande fornito per 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);

Si applica a

Vedi anche