Unlimited Technique          Unlimited Wisdom

1001010000101001000010010001000010000101101110111 1101010010010101011110010101110101011010101010101

导航

How to deal with the ‘void’ in IL

   If there is a method returning a object type,  it invokes a method returning null. Then the ‘ldnull’ instruction should be added after the invoking instruction.The description is demonstrated as follow:

 

.method public hidebysig virtual instance object

        Call(object[] A_1) cil managed

{

  // Code size       8 (0x8)

  .maxstack  1

  IL_0000:  ldarg.0

  IL_0001:  call       instance void MyDynamicProxy_TestClass1_0/__delegate__MyVoidMethod::Invoke()

  IL_0006:  ldnull

  IL_0007:  ret

} // end of method __delegate__MyVoidMethod::Call

 

     The method will return null value.

posted on 2005-07-18 09:55  bughole  阅读(243)  评论(0)    收藏  举报