您的位置:首页 > 其它

枚举,Enum,常规使用demo记录

2015-08-28 17:37 357 查看
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,
}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: