Global variable approach in C# Windows Forms application? (is public static class GlobalData the best)
问题 I want to have some custom configuration (read in from file) available throughout my C# Windows Forms application. Is the concept of say: creating a static class, e.g. "public static class GlobalData" loading from the "Load" action of the main form event How does this sound? Is this the best practice way to do it? 回答1: As others have stated, you can use AppSettings to store simple data. The basics are easy; going beyond them is hard (see App.Config and Custom Configuration Sections). You can