目录 枚举的基本用法回顾 枚举常见的设计模式运用 介绍 智能枚举 代码示例 业务应用 小结 枚举的基本用法回顾 以下是一个常见的 C# 枚举(enum)的示例: enum Weekday { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } class Program { static void Main(string[] args) { Weekday today = Weekday.Tuesday; Console.WriteLine("今天是" + today.ToString() + "。"); Console.WriteLine("明天是" + (Weekday)(((int)today + 1) % 7) + "。"); Console.WriteLine("昨天是" + (Weekday)(((int)today + 6) % 7) + "。"); } } 在这个示例中,我们定义了一个名为 Weekday 的枚举,其中包括每个星期的日子。然后在 Main 方法中,我们将 today...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with enum
Contact enum, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack