Edit

Share via


RealProxy.GetStubData(RealProxy) Method

Definition

Retrieves stub data that is stored for the specified proxy.

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

Parameters

rp
RealProxy

The proxy for which stub data is requested.

Returns

Stub data for the specified proxy.

Attributes

Exceptions

The immediate caller does not have UnmanagedCode permission.

Examples

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

Remarks

The stub data is used by custom proxy users to decide what to do with an incoming method call. For example, the stub data might be information about the server's context that you can use to determine whether to execute the call locally, or send it through the remoting infrastructure.

Applies to