using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcEnum.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            //int t=(int)TypeStyle.类型;
            /////根据枚举的值获取对应的名称
            //TypeStyle t1 = (TypeStyle)1;
            //TypeStyle t2 = (TypeStyle)2;
            //TypeStyle t3 = (TypeStyle)3;
      
            //ViewBag.Message = t3 +"//"+ t2+"//"+t3 + "修改此模板以快速启动你的 ASP.NET MVC 应用程序。";
            int t = (int)TypeStyle.类型;
            TypeStyle t1 = (TypeStyle)t;
            ViewBag.Message = t1 + t + "修改此模板以快速启动你的 ASP.NET MVC 应用程序。";
            return View();
        }
        public ActionResult About()
        {
            ViewBag.Message = "你的应用程序说明页。";
            return View();
        }
        public ActionResult Contact()
        {
            ViewBag.Message = "你的联系方式页。";
            return View();
        }
     
          public enum TypeStyle{
        
            类型=1,
            周期=2,
            判断=3,
        }
      
        
       
    }
}
原文:http://www.cnblogs.com/linbin524/p/4767120.html