// Setting a global variable private static string connectionString = "server=localhost;database=myDatabase;uid=myUser;pwd=myPassword;"; // Accessing the global variable SqlConnection connection = new SqlConnection(connectionString);
// Setting a global enum public enum LogLevel { None, Info, Warning, Error }; // Accessing the global enum LogLevel logLevel = LogLevel.Warning; if (logLevel >= LogLevel.Error) { Console.WriteLine("An error occurred!"); }In this example, `LogLevel` is a global enum that stores the different levels of logging that can be used in a program. It is declared as `public` so it can be accessed from any part of the code, and it can be used to determine which level of logging should be used in different parts of the program. The package library for this example is likely just the default C# libraries, as enums are built-in types in the language.