tags:

views:

167

answers:

3

Just out of curiosity ... is it possible to programmatically get the MSIL of a delegate? I'm curious because I've been toying with the idea of a distributed computing system where you can simply write programs, and the program itself would be distributed to each disparate node where work would occur. I know you could do it by copying the actual assembly over the network and loading that in an appdomain, but I think it would be really interesting to have a simpler model to work with.

thanks!

A: 

You can use either Reflector or ILDASM (MSIL Disassembler) to get the IL of any member in any .NET assembly.

Andrew Hare
+4  A: 

How is copying an assembly to another machine and loading it in an appdomain any more complex than the solution you're thinking of?

Justice
+1  A: 

What about the dependencies of the delegate code -- this might possibly work using CodeDom reflection emit, but if the delegate calls anything outside itself (even framework code), how are you going to ensure it exists on the target machine(s)? Lots of Assembly.Load() code?

By the way: if you build a dynamically changing distributed system along these lines, you ain't gonna get me to maintain or operate it! Imagine doing fault isolation or trying to do anything like comprehensive testing...

Pontus Gagge