Global variables declaration

  • Thread starter Thread starter RP
  • Start date Start date
R

RP

In VB we used to add a module that contained public variables,
procedures and functions. Where to declare global variables and
functions in C# so that they are accessible everywhere.
 
The equivalent of doing this in C# is to make the methods and variables
static.
 
RP:

There are no such things as "global" variables and methods in C#.
The way to handle this in C# is to declare a static class that contains
static variables and methods, e.g.,

static class MyGlobals {
public static void myFunction(int n) { }
public static _global_count = 0;
}

jpuopolo
 
Back
Top