using System;
using System.Collections.Generic;
namespace test
{
public enum Color
{
Red
}
class Program
{
static void Main()
{
string str = "Red";
Color newC = (Color)Enum.Parse(typeof(Color), str);
Console.WriteLine(newC.ToString());
Console.ReadKey();
}
}
}
Enum.Parse
最新推荐文章于 2025-04-03 09:19:31 发布