I'm working on some C# code where I have several files that use the same public variables (let's call these variables a, b, and c for now). Disclaimer: please don't berate me on the quality of the code, I didn't write it, it's simply my job to fix it. These variables are public and shared across all files, and should really be an array (a, b, and c all do the same thing, with slightly different properties). I am modifying the largest file of the bunch to take out all references to the variables and replace them with an array letters[], but other files contain disparate references to these variables. Is there any way to, in other files, define a variable or macro of some kind so that I don't have to change every reference in every file?
For example: In the biggest file "main.cs", I used to have:
public string a;
public string b;
public string c;
a = "a";
b = "b";
c = "c";
but I fixed it to have:
string[] letters;
letters[0] = "a";
//etc
Now, in file "small.cs", I have
a = "hello world";
b = "goodbye world";
Instead of having to go through every single file, is there any way that I could just have 'a' be defined as the first element of letters (letters[0]
), b reference letters[1]
, etc? This way, the program would still run, and in the small files, C# would know that any reference to 'a' really means a references to letters[0]
.