enum and string converation

public enum BookType
{
Ticket,
Trip,
Hotel
}
从String到enum
BookType type
= (BookType)Enum.Parse(typeof(BookType),"Ticket");
从enum到String
方法一:ToString();
方法二:s
= Enum.GetName(typeof(BookType), BookType.Ticket);

posted @ 2011-05-23 15:31  doo  阅读(239)  评论(0编辑  收藏  举报