I am creating a project in Visual Studio 2010 using C#.
I have my main (program.cs
) and several different classes in different file (class1.cs
class2.cs
class3.cs
), and each class has its own function.
I was wondering if there is a way to set a variable (say in program.cs
) that's accessible from each different class files?
To reduce confusion, I'll explain in example.
The program.cs is to create files. Each class is to create different type of files (txt, xml, xls, etc). I want to specify the path to save the file in program.cs
, so if I want to change the path, I only have to change it in one place.
I want to set up a variable that's accessible from each class file, instead of passing the 'path' variable into the functions.
Is there a way to do so?