共用方式為


SoapServices.GetXmlNamespaceForMethodCall(MethodBase) 方法

定義

擷取 XML 命名空間,使用於給定 MethodBase 中所指定方法的遠端呼叫中。

public:
 static System::String ^ GetXmlNamespaceForMethodCall(System::Reflection::MethodBase ^ mb);
public static string GetXmlNamespaceForMethodCall (System.Reflection.MethodBase mb);
[System.Security.SecurityCritical]
public static string GetXmlNamespaceForMethodCall (System.Reflection.MethodBase mb);
static member GetXmlNamespaceForMethodCall : System.Reflection.MethodBase -> string
[<System.Security.SecurityCritical>]
static member GetXmlNamespaceForMethodCall : System.Reflection.MethodBase -> string
Public Shared Function GetXmlNamespaceForMethodCall (mb As MethodBase) As String

參數

mb
MethodBase

對其要求 XML 命名空間之方法的 MethodBase

傳回

XML 命名空間,使用於所指定方法的遠端呼叫中。

屬性

例外狀況

立即呼叫端沒有基礎結構使用權限。

範例

下列程式碼範例會顯示如何使用這個方法。 此程式碼範例是提供給 類別之較大範例的 SoapServices 一部分。

// Print the XML namespace for a method invocation and its
// response.
System::Reflection::MethodBase^ getHelloMethod =
   ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );
String^ methodCallXmlNamespace =
   SoapServices::GetXmlNamespaceForMethodCall( getHelloMethod );
String^ methodResponseXmlNamespace =
   SoapServices::GetXmlNamespaceForMethodResponse( getHelloMethod );
Console::WriteLine( L"The XML namespace for the invocation of the method "
L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace );
Console::WriteLine( L"The XML namespace for the response of the method "
L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace );
// Print the XML namespace for a method invocation and its
// response.
System.Reflection.MethodBase getHelloMethod = 
    typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");
string methodCallXmlNamespace = 
    SoapServices.GetXmlNamespaceForMethodCall(getHelloMethod);
string methodResponseXmlNamespace =
    SoapServices.GetXmlNamespaceForMethodResponse(getHelloMethod);
Console.WriteLine(
    "The XML namespace for the invocation of the method " +
    "GetHello in ExampleClass is {0}.",
    methodResponseXmlNamespace);
Console.WriteLine(
    "The XML namespace for the response of the method " +
    "GetHello in ExampleClass is {0}.",
    methodCallXmlNamespace);

適用於