What is the C# equiv to Module?

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
I work with classes... what is this Module stuff? I thought that would of went away with VB6... a module isn't a class... are people using this in VB? Should they be? I wouldn't think so.
 
I would've hoped that they would've done away with Modules in vb.net but that's not the case. I don't think there is an equivalant in C#. Thank god.
 
if you really can't avoid something "module-like" I would suggest using a class with static variables and methods

Code:
public class MyClass
{
   public static int GlobalVariable;
   private static int testProperty;

   public static void ShowMessage(string message)
   {
       Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " -> " + message);
       MessageBox.Show(message);
   }

   public static int TestProperty
   {
      get{return testProperty;}
      set{testProperty = value;}
   }
}

but we have the prossiblity to write object oriented code - so why stick to the old concepts?

Andreas
 
Thanks guys, just wanted to make sure it's worthless before I waste time looking at it.
 
Back
Top