Bagikan melalui


SoapServices.GetXmlElementForInteropType(Type, String, String) Metode

Definisi

Mengembalikan informasi elemen XML yang harus digunakan saat membuat serialisasi jenis yang diberikan.

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

Parameter

type
Type

Objek Type tempat elemen XML dan nama namespace layanan diminta.

xmlElement
String

Ketika metode ini kembali, berisi String yang menyimpan nama elemen XML dari jenis objek yang ditentukan. Parameter ini diteruskan tanpa diinisialisasi.

xmlNamespace
String

Ketika metode ini kembali, berisi String yang menyimpan nama namespace XML dari jenis objek yang ditentukan. Parameter ini diteruskan tanpa diinisialisasi.

Mengembalikan

true jika nilai yang diminta telah ditetapkan ditandai dengan SoapTypeAttribute; jika tidak, false.

Atribut

Pengecualian

Pemanggil langsung tidak memiliki izin infrastruktur.

Contoh

Contoh kode berikut menunjukkan cara menggunakan metode ini. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SoapServices kelas .

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

Berlaku untuk

Lihat juga