using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace test { enum Gender { 男, 女 } class Program { static void Main(string[] args) { //Gender sex = Gender.男; Console.WriteLine("hello"); string input = Console.ReadLine(); Gender sex = (Gender)Enum.Parse(typeof(Gender), input); Console.WriteLine("your input is : {0}", sex); Console.ReadKey(); } } }
c# 枚举类型
最新推荐文章于 2024-06-06 17:14:19 发布