RealProxy.GetStubData(RealProxy) 方法

定义

检索为指定的代理存储的存根 (Stub) 数据。

public:
 static System::Object ^ GetStubData(System::Runtime::Remoting::Proxies::RealProxy ^ rp);
public static object GetStubData (System.Runtime.Remoting.Proxies.RealProxy rp);
[System.Security.SecurityCritical]
public static object GetStubData (System.Runtime.Remoting.Proxies.RealProxy rp);
static member GetStubData : System.Runtime.Remoting.Proxies.RealProxy -> obj
[<System.Security.SecurityCritical>]
static member GetStubData : System.Runtime.Remoting.Proxies.RealProxy -> obj
Public Shared Function GetStubData (rp As RealProxy) As Object

参数

rp
RealProxy

需要存根 (Stub) 数据的代理。

返回

指定代理的存根 (Stub) 数据。

属性

例外

直接调用方没有 UnmanagedCode 权限。

示例

// Create an instance of MyProxy.
MyProxy^ myProxyInstance = gcnew MyProxy( CustomServer::typeid );

// Get a CustomServer proxy.
CustomServer^ myHelloServer = static_cast<CustomServer^>(myProxyInstance->GetTransparentProxy());

// Get stubdata.
Console::WriteLine( "GetStubData = {0}", RealProxy::GetStubData( myProxyInstance ) );
// Create an instance of MyProxy.
MyProxy myProxyInstance = new MyProxy(typeof(CustomServer));
// Get a CustomServer proxy.
CustomServer myHelloServer = (CustomServer)myProxyInstance.GetTransparentProxy();
// Get stubdata.
Console.WriteLine("GetStubData = " + RealProxy.GetStubData(myProxyInstance).ToString());
' Create an instance of MyProxy.
Dim myProxyInstance As New MyProxy(GetType(CustomServer))
' Get a CustomServer proxy.
Dim myHelloServer As CustomServer = _
            CType(myProxyInstance.GetTransparentProxy(), CustomServer)
' Get stubdata.
Console.WriteLine("GetStubData = " + RealProxy.GetStubData(myProxyInstance).ToString())

注解

存根数据由自定义代理用户用来决定对传入方法调用执行的操作。 例如,存根数据可能是有关服务器上下文的信息,可用于确定是在本地执行调用,还是通过远程处理基础结构发送调用。

适用于