RemotingServices.IsObjectOutOfAppDomain(Object) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne une valeur Boolean indiquant si l'objet spécifié par le proxy transparent donné est contenu dans un domaine d'application différent de celui de l'objet qui a appelé la méthode en cours.
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
Paramètres
- tp
- Object
Objet à vérifier.
Retours
true
si l'objet est à l'extérieur du domaine d'application en cours ; sinon false
.
Exemples
// 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)
Remarques
Pour plus d’informations sur les domaines d’application, consultez Domaines d’application.