I need to read XML file and store all the info inside variables/class when the software starts, and make the variables/classes be accessible every class.
With C++, I could use global variables or classes, even though it’s not a good practice to have a global variables.
- If the variables/classes are read only data, what methods can I use for my purpose with C#?
- What if the variables/classes are read/write?
You could use a public static class, and make everything available from there. You could populate it with data at creation time. It won’t technically be at global scope, but would make the data easily available, and you wouldn’t explicitly have to instantiate anything.