惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
IT之家
IT之家
博客园 - 叶小钗
雷峰网
雷峰网
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
博客园 - 【当耐特】
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
Last Week in AI
Last Week in AI
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美

博客园 - 思然

邮件带图片附件 - 思然 - 博客园 XML查找节点 - 思然 - 博客园 动态生成rdlc 报表(原创) 图片处理 - 思然 - 博客园 数据绑定及其他 - 思然 - 博客园 图片上传及网络相册功能 SQL Server 2005 Express 使用心得 - 思然 附加进程调试和存储过程调试 (转)DIV CSS布局教程:应用ul、li实现表格形式 用户控件的使用经验 缓存之缓存文件依赖及编程方式设置输出缓存过期 防刷新多次提交 添加div符号注意符号问题 Datalist调用本地文件绑定图片 用户控件-TreeView的用法 关于table控件的一个疑难问题(涉及循环) 关于javascript调用webservices的中文参数乱码的问题 服务器端和客户端清除TextBox控件的值 获取母版页的控件的方法
枚举的应用
思然 · 2008-06-13 · via 博客园 - 思然

 GetEmu(CustomerKind.Normal);  
public enum CustomerKind
    {
      Normal = 90,
      Vip = 80,
      SuperVip = 70,
      InActive = 100
    }
//一种是用来判断
 public void GetEmu(CustomerKind c)
    {
        switch (c)
        {
            case CustomerKind.Normal:
                Response.Write((int)CustomerKind.Normal);
                break;
            case CustomerKind.Vip:
                Response.Write((int)CustomerKind.Vip);
                break;
            default:
                Response.Write((int)CustomerKind.InActive);
                break;
        }
    }
//另一种是用来计算

  void bind()
    {
        if (Request.QueryString["id"] == null)
        {

           Response.Write(300/100 * (int)CustomerKind.Normal);
           Response.Write(CustomerKind.Normal);
        }
        else
        {
            Response.Write(CustomerKind.Vip);
            Response.Write(300 / 100 * (int)CustomerKind.Vip);
        }
    }

  void bind()
    {
        if (Request.QueryString["id"] == null)
        {

           Response.Write(300/100 * (int)CustomerKind.Normal);
           Response.Write(CustomerKind.Normal);
        }
        else
        {
            Response.Write(CustomerKind.Vip);
            Response.Write(300 / 100 * (int)CustomerKind.Vip);
        }
    }