RemotingServices.IsObjectOutOfAppDomain(Object) Method

Definition

Returns a Boolean value that indicates whether the object specified by the given transparent proxy is contained in a different application domain than the object that called the current method.

public:
 static bool IsObjectOutOfAppDomain(System::Object ^ tp);
public static bool IsObjectOutOfAppDomain (object tp);
static member IsObjectOutOfAppDomain : obj -> bool
Public Shared Function IsObjectOutOfAppDomain (tp As Object) As Boolean

Parameters

tp
Object

The object to check.

Returns

true if the object is out of the current application domain; otherwise, false.

Examples

// Create a remote version of TempConverter::Converter.
TempConverter::Converter^ converter1 =
      dynamic_cast<TempConverter::Converter^>(Activator::GetObject(
      TempConverter::Converter::typeid,
      "http://localhost:8085/TempConverter" ));

// Create a local version of TempConverter::Converter.
TempConverter::Converter^ converter2 = gcnew TempConverter::Converter;

// Returns true, converter1 is remote and in a different appdomain.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter1 );

// Returns false, converter2 is local and running in this appdomain.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter2 );

// Returns true, converter1 is remote and in a different context.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter1 );

// Returns false, converter2 is local and running in this context.
System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter2 );
// Create a remote version of TempConverter.Converter.
TempConverter.Converter converter1 =
        (TempConverter.Converter) Activator.GetObject(
        typeof(TempConverter.Converter),
        "http://localhost:8085/TempConverter");

// Create a local version of TempConverter.Converter.
TempConverter.Converter converter2 = new TempConverter.Converter();

// Returns true, converter1 is remote and in a different appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(
                        converter1);

// Returns false, converter2 is local and running in this appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(
                        converter2);

// Returns true, converter1 is remote and in a different context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext(
                        converter1);

// Returns false, converter2 is local and running in this context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext(
                        converter2);
' Create remote version of TempConverter.Converter.
Dim converter1 As TempConverter.Converter

converter1 = CType(Activator.GetObject(GetType( _
                     TempConverter.Converter), _
                     "http://localhost:8085/TempConverter"), _
                     TempConverter.Converter)
' Create local version of TempConverter.Converter.
Dim converter2 As New TempConverter.Converter()

' Returns true, converter1 is remote and in a different appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain( _
                                                   converter1)

' Returns false, converter2 is local and running in this appdomain.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain( _
                                                   converter2)

' Returns true, converter1 is remote and in a different context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext( _
                                                   converter1)

' Returns false, converter2 is local and running in this context.
System.Runtime.Remoting.RemotingServices.IsObjectOutOfContext( _
                                                   converter2)

Remarks

For information about application domains, see Application Domains.

Applies to

See also