c# 将枚举作为键值的形式存储
来源:互联网 发布:施工用电方案软件 编辑:程序博客网 时间:2024/04/30 19:14
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace 将枚举作为键值的形式存储
{
enum Myenum
{
First=3,
Second,
Third
}
class Program
{
static void Main(string[] args)
{
//用hashtable可以实现吗? NameValueCollection可以实现吗?
Dictionary<string, int> dictionary = new Dictionary<string, int>();
string [] enumArray=Enum.GetNames(typeof(Myenum));
for (int i = 0; i < enumArray.Length; i++)
{
dictionary.Add(enumArray[i],(int) Enum.Parse(typeof(Myenum), enumArray[i]));
}
Console.WriteLine(dictionary["First"]);
Console.WriteLine(dictionary["Second"]);
Console.WriteLine(dictionary["Third"]);
Console.Read();
}
}
}
- c# 将枚举作为键值的形式存储
- C# 将json字符串转换为键值对形式,用于执行form表单形式的请求
- C#将一个窗体作为另一个窗体的对话框形式弹出
- c# 将json中的数据转为键值的形式放入字典Dictionary并进行拼接md5加密
- 将等号作为键值的js字符串转json
- 建议7: 将0值作为枚举的默认值
- 建议7 将0值作为枚举的默认值
- Tip7 将0值作为枚举的默认值
- JavaScript将url地址快速变成键值对的JavaScript对象形式
- C# 把数据字典表的数据自动生成为 js 键值对形式
- 将Activity作为Dialog形式展现
- 将aspx网页以HTML形式存储的几个方法
- 将IP以整型的形式存储到数据库中
- c#枚举 获取枚举键值对、描述等
- 将DataTable作为存储过程参数的用法
- C#控制台 将变量以百分比的形式输出
- 学习C#委托:将方法作为方法的参数
- C# 将方法作为参数的方法 -- 委托
- 关于习惯
- Exploration poj
- MSN/Fetion内容监控
- 寻求多媒体(音频)管理工具
- 赢得起,输得起
- c# 将枚举作为键值的形式存储
- android MID
- 女孩其实只要对她好
- 修改sa的密码问题
- Python处理日志之取得文件列表(更新)
- 用OgreMax插件从3ds max导出ogre模型文件(.mesh/.skeleton)
- 测试对hashatable和NameValueCollection遍历的不同
- makefile 相关
- 工作回顾