RemotingServices.IsObjectOutOfContext(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回布林值,指出指定之 Proxy 所表示的物件和呼叫目前方法的物件是否包含在不同的內容中。
public:
static bool IsObjectOutOfContext(System::Object ^ tp);
public static bool IsObjectOutOfContext (object tp);
static member IsObjectOutOfContext : obj -> bool
Public Shared Function IsObjectOutOfContext (tp As Object) As Boolean
參數
- tp
- Object
要檢查的物件。
傳回
如果物件源自目前的內容,則為 true
,否則為 false
。
範例
// 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)
備註
內容是已排序的屬性序列,可定義位於其中之對象的環境。 內容會在啟用程式期間建立,這些物件設定為需要特定自動服務,例如同步處理、交易、Just-In-Time 啟用、安全性等等。 同一個內容可包含多個物件。