我在使用C#做一些测试,现在需要知道一些东西。我创建了一个类,像这样:
class DChanger
{
//Just ignore this:
private string section = Csuc.CPanel.CPanelSection.Appearance;
//Then the constructor: DChanger dchange = new DChanger(Internet);
public void DChanger(string subsection)
{
//Code
}
}
现在,我想检查 "subsection" 是否可以转换为另一种类型。比如,我已经有一个enum:
enum Subsections { Internet, Programming };
我想检查“subsection”是否为“Internet”或“Programming”(在此示例中,因为真实枚举有更多的部分)。 我可以这样做吗?谢谢!