枚举,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,
}
}
}
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,
}
}
}
相关文章推荐
- Komodo for mac 破解版
- Python字符串的encode与decode研究心得乱码问题解决方法
- 集合、Collection、List的总体概述
- 我的DOM库 (持续更新)
- typedef函数指针用法
- UIScrollView 期本使用方法
- 查找字符串中的最长回文问题评述
- 张逸:ThoughtWorks(中国)程序员读书雷达
- 三角函数逼近锯齿函数和阶梯函数
- user,debug,userdebug版本
- 通俗易懂学C语言-02-C语言程序长啥样以及运行流程
- Apache Http Server和Tomcat 之区别
- TableViewer使用
- Iframe知识点
- UISegment
- UISlide
- Ruby 批量下载图片文件
- executeQuery()
- CentOS, FreeBSD, Ubuntu LTS 维护风格的简单比较
- how to find error in log