.comment-link {margin-left:.6em;}


.. Hello Earthling .. \o/ :)

Modules in VB.net
Friday, August 20, 2004

Types themsleves cannot be static in C# yet. However, you can make your methods and fields static and then use them from anywhere. For me that would achieve that same purpose like a module in VB. And in fact this is what happens at the IL level. When you make modules in VB they are just converted into classes with all the methods and fields in them set to "static". For example, if I have a method Add in my Module1 as:
Public Function add(ByVal x As Integer, ByVal y As Integer) As Integer
Return x + y
End Functionit

it gets converted to the following IL:

.method public static int32 'add'(int32 x,
int32 y) cil managed
// Code size 9 (0x9)
.maxstack 2
.locals init ([0] int32 'add')
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: add.ovf
IL_0004: stloc.0
IL_0005: br.s IL_0007
IL_0007: ldloc.0
IL_0008: ret
} // end of method Module1::'add'

Shared in VB is equivilent to static in C#. The concept of modules in VB comes from old VB versions and is now there only for backwards compatibility reasons. In the old versions, I rememeber that while doing the win32api programming we could place our callback functions only in modules, not in classes.

SHA-0 Broken, MD5 Rumored Broken
Tuesday, August 17, 2004

What ever you do , they'll break it. Read more about broken hash functions here.


MSDN Blogs
Joel Pobar
Don Syme

Muhammad Ali
Lahore Food Blog

Tech Blog



June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   February 2005   April 2005   June 2005   July 2005   September 2005   October 2005   November 2005   June 2007   December 2007   January 2008   March 2008   April 2008   June 2008   October 2008   February 2009   May 2009   June 2009   July 2009   August 2009   March 2011   June 2011   July 2011   September 2011   October 2011   November 2011   December 2012   May 2013   October 2013   May 2014   March 2015   July 2015   August 2015   December 2015   March 2016   July 2016   October 2016   November 2016   July 2017   December 2017   May 2018  

This page is powered by Blogger. Isn't yours?