This documentation is archived and is not being maintained.

RemotingServices.IsObjectOutOfAppDomain Method

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

[Visual Basic]
Public Shared Function IsObjectOutOfAppDomain( _
   ByVal tp As Object _
) As Boolean
[C#]
public static bool IsObjectOutOfAppDomain(
 object tp
);
[C++]
public: static bool IsObjectOutOfAppDomain(
 Object* tp
);
[JScript]
public static function IsObjectOutOfAppDomain(
   tp : Object
) : Boolean;

Parameters

tp
The object to check.

Return Value

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

Remarks

For information on AppDomains see Application Domains.

Example

[Visual Basic] 
' 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)

[C#] 
// 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);

[C++] 
// Create a remote version of TempConverter::Converter.
TempConverter::Converter* converter1 =
    dynamic_cast<TempConverter::Converter*>(Activator::GetObject(__typeof(TempConverter::Converter),
    S"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);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

RemotingServices Class | RemotingServices Members | System.Runtime.Remoting Namespace | Application Domains

Show: