Repository navigation
EN CSharp Enums
Codex edited this page Oct 11, 2026
·
2 revisions
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
enum specifies named integer values. It is convenient to use for scenario states. Bit flags typically have powers of two values and a [Flags] attribute. Converting a number to an enum does not in itself guarantee that the value is declared.
Save this example separately as Example.cs. Run it independently of the other examples on this page.
Example.cs:
// PROJECT-EXAMPLE
State state = State.Ready;
System.Console.WriteLine(state);
enum State { Idle, Ready }Result:
Ready
enum ScriptMode { Idle, Searching, Completed }
ScriptMode mode = ScriptMode.Searching;
UO.Print(mode.ToString());[Flags]
enum Checks { None = 0, Health = 1, Weight = 2, Target = 4 }
Checks enabled = Checks.Health | Checks.Weight;
bool checkHealth = (enabled & Checks.Health) != 0;
UO.Print($"Enabled={enabled}, health={checkHealth}");For the interface, use clear state names. The Completed value describes your algorithm state and does not automatically confirm the game server's response.
Official Documentation: Enumerations and Bit Flags - Microsoft Learn.
ClassicUO — Bad Newbie & C# Scripts IDE