Hi,
I am learning C#, having a good C background as a programmer.
I need to port a C application to C#, but there is a very basic problems that stalls me.
My C program has many subroutines, each of them in its own file. They share a common .h include file, that holds various definitions and global variables.
Since C# does not use include files, my first idea is to define a specific namespace for all the routines and global variables that will mimic the C ones.
I would imagine something like in a "aProgram.cs" file:
#define aDefinition 3
namespace C
{
int aGlobalVariable;
double *aNotherGlobal;
void SubRoutine1()
{
SubRoutine2();
}
}
My problem is that I don't want to have all the C subroutines to be included is the same .cs file. There are to many of them for that to be practical.
But if I create a second "aProgram_2.cs" file like:
namespace C
{
Void SubRoutine2()
{
aGlobalVariable = 2;
}
}
SubRoutine1() is not able to access SubRoutine2(), and SubRoutine2() cannot access aGlobalVariable, nor aDefinition;
How can I create a pool of routines and variables (and #define items) that will be accessible from different "cs" files?