易截截图软件、单文件、免安装、纯绿色、仅160KB

c# 将枚举作为键值的形式存储

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#与Flash交互

C#与Flash交互 (转自小磊在线)
C#与Flash交互
前段日子公司要求做一个C#与Flash交互的东西,用来C#与短信猫通讯将数据传到Flash上显示与操作的应用。
第一步C#添加组件
打开VS2005-工具-选择工具箱项-COM组件-选择Shockwave Flash Object-确定
添加好组件往场景上拖放,如果提示注册需求注册
c# 注册控件-在运行输 ......

C# Xml中映射为类数据结构(报文)

        [System.Runtime.Serialization.DataMemberAttribute()]
        public Information Archive {
            get {
         &n ......

java与c#通信数据转换问题

/由于JAVA语言的数据类型都是有符号类型,而C# C++一般数据类型都是分有符号和无符号,
//因此在通信过程中传递的Byte[]无法直
接转换成C#需要的类型,
//以前倒是没注意这些细节,因为一般用一种语言编程,
//大都有内置的转换方法。跨语言环境的转换就的自己动
手想办法了。
1、java的Byte[]转换成c#的Int32
privat ......

C#中调用mysql存储过程出现的问题

在root账号中,可以正常调用存储过程.
换到common_user账号时,同一存储过程名调用出现问题.
追踪调试时出现:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
搜索解决方案:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;dat ......

asp.net c# 数据库备份

protected void btnsearch_ServerClick(object sender, EventArgs e)
    {
        string lujing=this.Text2.Value.ToString().Trim();
        string shujuku = this.jine.Value;
      &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号