如何确定对象是本地的还是远程的(使用C# remoting)?无论是检查本地代码(如果对象是远程的)还是在对象中(如果代码是从远程执行的)都可以。
发布于 2009-11-03 04:53:58
if(System.Runtime.Remoting.RemotingServices.IsTransparentProxy(myObject))
Console.WriteLine("Yay - my object is a remoted object.");
else
Console.WriteLine("Boo - my object is not a remoted object.");MSDN Docs on IsTransparentProxy
发布于 2009-11-03 04:38:05
我想您可以查看代理,看看它是否派生自TransparentProxy
var myObj = ....;
if(myObj is TransparentProxy)
Console.WriteLine("I have a remote object");
else
Console.WriteLine("I don't think I have a remote object");https://stackoverflow.com/questions/1663510
复制相似问题