k10n
Jim Klopfenstein's Radio Weblog

 

 

 

 

  Thursday, August 01, 2002

My Generic Proxy


Looking over Peter’s slides from his SSCLI remoting talk in Cambridge reminded me of a little experiment I did last fall.

It’s a class I wrote called MyGenericProxy. A MyGenericProxy acts like any type you tell it to act like (as long as the object is stateless). It does this by constructing an real object of that type behind the scenes (using reflection) and calling methods on that object based on the messages it receives.  After you construct it, you call GetTransparentProxy on it and cast the object returned to the type you want it to act like.  Then you can treat this object just like an object of the type you specified.

I discovered that if two types have the same inheritance hierarchy, you can even switch between them on the fly. This little program demonstrates this.

I can’t say it’s useful, but it did teach me a thing or two about proxies.

4:56:43 PM    


Click here to visit the Radio UserLand website. © Copyright 2003 Jim Klopfenstein.
Last update: 3/14/2003; 11:41:48 AM.

August 2002
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Jul   Sep




Subscribe to "k10n" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.