2009-11-02 94 views

回答

4
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

+0

我投这个答案是因为它提供了有关特定FCL方法的MSDN文档链接,我喜欢看到引用的框架创建者的想法。其他选项可能存在,但Microsoft明确规定了这种方法。 –

0

我想你可以看看代理,看看它是否从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"); 
+0

派生你能告诉我如何做一些更多的细节? TransparentProxy似乎是一个内部类,而且非常透明*。 – eWolf