-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Gags
Message 1 in Discussion

Module Module1 

  Sub Main() 
    Dim I As New Object() 
   
     If I Is Nothing Then 
      'do something 
    End If 

  End Sub 

End Module 

Produces .. 

method public static void Main() cil managed 
{ 
 .entrypoint 
 .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) 
 // Code size    18 (0x12) 
 .maxstack 1 
 .locals init ([0] object I) 
 IL_0000: nop 
 IL_0001: newobj   instance void [mscorlib]System.Object::.ctor() 
 IL_0006: call    object 
[mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue(object) 
 IL_000b: stloc.0 
 IL_000c: ldloc.0 
 IL_000d: brtrue.s  IL_000f 
 IL_000f: nop 
 IL_0010: nop 
 IL_0011: ret 
} // end of method Module1::Main 


and  

Module Module1 

  Sub Main() 
    Dim I As New Object() 
   
    If IsNothing(I) Then 
      'do something 
    End If 

  End Sub 

End Module 

Producess .. 

method public static void Main() cil managed 
{ 
 .entrypoint 
 .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) 
 // Code size    28 (0x1c) 
 .maxstack 1 
 .locals init ([0] object I) 
 IL_0000: nop 
 IL_0001: newobj   instance void [mscorlib]System.Object::.ctor() 
 IL_0006: call    object 
[mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue(object) 
 IL_000b: stloc.0 
 IL_000c: ldloc.0 
 IL_000d: call    object 
[mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue(object) 
 IL_0012: call    bool 
[Microsoft.VisualBasic]Microsoft.VisualBasic.Information::IsNothing(object) 
 IL_0017: brfalse.s IL_0019 
 IL_0019: nop 
 IL_001a: nop 
 IL_001b: ret 
} // end of method Module1::Main 


In the second case there are few extra IL lines and its using MicroSoft.VisualBasic. 

Now which one would be the better statement to use? 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to