public enum OpType   
{   
  Addnew,   
  Update,   
  Delete   
}  
public enum OpType
{
  Addnew,
  Update,
  Delete
}   
1.根據(jù)枚舉列表名字字串取得對應的值。
string opStr = "Delete";   
int result = (int)Enum.Parse(typeof(OpType), opStr);  
string opStr = "Delete";
int result = (int)Enum.Parse(typeof(OpType), opStr);
 
2.將枚舉轉換為數(shù)組。
Enum.GetNames(typeof(OpType))
新聞熱點
疑難解答