IRemotingTypeInfo インターフェイス

オブジェクトの型情報を提供します。

この型のすべてのメンバの一覧については、IRemotingTypeInfo メンバ を参照してください。

Public Interface IRemotingTypeInfo
[C#]
public interface IRemotingTypeInfo
[C++]
public __gc __interface IRemotingTypeInfo
[JScript]
public interface IRemotingTypeInfo

解説

ObjRef オブジェクトと共に渡されるカスタムの型情報を提供するには、このインターフェイスを使用します。

使用例

 
Dim objRefSample As ObjRef = RemotingServices.GetObjRefForProxy(myRemoteObject)
Console.WriteLine("***ObjRef Details***")
Console.WriteLine("URI:" + ControlChars.Tab + "{0}", objRefSample.URI)
Dim channelData As Object() = objRefSample.ChannelInfo.ChannelData
Console.WriteLine("Channel Info:")
Dim o As Object
For Each o In  channelData
   Console.WriteLine(ControlChars.Tab + "{0}", o.ToString())
Next o
Dim envoyInfo As IEnvoyInfo = objRefSample.EnvoyInfo
If envoyInfo Is Nothing Then
   Console.WriteLine("This ObjRef does not have envoy information.")
Else
   Dim envoySinks As IMessageSink = envoyInfo.EnvoySinks
   Console.WriteLine("Envoy Sink Class: {0}", envoySinks)
End If
Dim typeInfo As IRemotingTypeInfo = objRefSample.TypeInfo
Console.WriteLine("Remote type name: {0}", typeInfo.TypeName)
Console.WriteLine("Can my object cast to a Bitmap? {0}", typeInfo.CanCastTo(GetType(System.Drawing.Bitmap), objRefSample))
Console.WriteLine("Is this object from this AppDomain? {0}", objRefSample.IsFromThisAppDomain())
Console.WriteLine("Is this object from this process? {0}", objRefSample.IsFromThisProcess())

[C#] 
ObjRef objRefSample = RemotingServices.GetObjRefForProxy(myRemoteObject);
Console.WriteLine("***ObjRef Details***");
Console.WriteLine("URI:\t{0}", objRefSample.URI);
object[] channelData = objRefSample.ChannelInfo.ChannelData;
Console.WriteLine("Channel Info:");
foreach(object o in channelData)
    Console.WriteLine("\t{0}", o.ToString());
IEnvoyInfo envoyInfo = objRefSample.EnvoyInfo;
if (envoyInfo == null) {
    Console.WriteLine("This ObjRef does not have envoy information.");
}
else {
    IMessageSink envoySinks = envoyInfo.EnvoySinks;
    Console.WriteLine("Envoy Sink Class: {0}", envoySinks);
}
IRemotingTypeInfo typeInfo = objRefSample.TypeInfo;
Console.WriteLine("Remote type name: {0}", typeInfo.TypeName);
Console.WriteLine("Can my object cast to a Bitmap? {0}",
    typeInfo.CanCastTo(typeof(System.Drawing.Bitmap), objRefSample));
Console.WriteLine("Is this object from this AppDomain? {0}", objRefSample.IsFromThisAppDomain());
Console.WriteLine("Is this object from this process? {0}",  objRefSample.IsFromThisProcess());

[C++] 
ObjRef* objRefSample = RemotingServices::GetObjRefForProxy(myRemoteObject);
Console::WriteLine(S"***ObjRef Details***");
Console::WriteLine(S"URI:\t {0}", objRefSample->URI);
Object* channelData[] = objRefSample->ChannelInfo->ChannelData;
Console::WriteLine(S"Channel Info:");
IEnumerator* myEnum = channelData->GetEnumerator();
while (myEnum->MoveNext()) 
{
    Object* o = __try_cast<Object*>(myEnum->Current);

    Console::WriteLine(S"\t {0}", o);
    IEnvoyInfo* envoyInfo = objRefSample->EnvoyInfo;
    if (envoyInfo == 0) 
    {
        Console::WriteLine(S"This ObjRef does not have envoy information.");
    }
    else 
    {
        IMessageSink* envoySinks = envoyInfo->EnvoySinks;
        Console::WriteLine(S"Envoy Sink Class: {0}", envoySinks);
    }
    IRemotingTypeInfo* typeInfo = objRefSample->TypeInfo;
    Console::WriteLine(S"Remote type name: {0}", typeInfo->TypeName);
    Console::WriteLine(S"Can my Object cast to a Bitmap? {0}",
        __box(typeInfo->CanCastTo(__typeof(System::Drawing::Bitmap), objRefSample)));
    Console::WriteLine(S"Is this Object from this AppDomain? {0}", __box(objRefSample->IsFromThisAppDomain()));
    Console::WriteLine(S"Is this Object from this process? {0}",  __box(objRefSample->IsFromThisProcess()));

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Runtime.Remoting

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: Mscorlib (Mscorlib.dll 内)

参照

IRemotingTypeInfo メンバ | System.Runtime.Remoting 名前空間