163K网站系统官方论坛's Archiver

yuying 发表于 2007-2-16 18:20

.net教程:一个简单的.net remoting客户端例子

[size=3]一个简单的.net remoting客户端例子



public static void main()
{
      remotingconfiguration.configure("client.exe.config");

      remotabletype type1 = new remotabletype();
      type1.stringmethod();
}  
对应的il为:  
.method public hidebysig static void main() cil managed
{
      .entrypoint
      // code size: 24 byte(s)
      .maxstack 1
      .locals (
            [remotabletype]remotabletype type1)
      l_0000: ldstr "client.exe.config"
      l_0005: call void [mscorlib]system.runtime.remoting.  remotingconfiguration::configure(string)
      l_000a: newobj instance void [remotabletype]remotabletype::.ctor()
      l_000f: stloc.0
      l_0010: ldloc.0
      l_0011: callvirt instance string [remotabletype]remotabletype::stringmethod()
      l_0016: pop
      l_0017: ret
}
newobj将会调用activationservices.iscurrentcontextok()  callvirt将会调用realproxy.privateinvoke()   





[/size]

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.