易截截图软件、单文件、免安装、纯绿色、仅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();
         
        }
    }
}


相关文档:

Delphi 调用 C#的Webservice 不能传入参数


Delphi7 调用 C#的Webservice 不能传入参数
解决办法:
在Delphi导入WSDL后生成的单元的最后一行,即initialization里的初始化端口的代码中加入代码
InvRegistry.RegisterInvokeOptions(TypeInfo(接口名), ioDocument);
即可
 
 
......

C#将空值传入到Oracle字段类型为Datatime的字段

今天做项目的时候,将null传入Oracle的表中,就是不成功
经过尝试得出了两个解决方案:
1.传入OracleDateTime.NULL
2.Nullable<DateTime> optime = DBNull.Value; 传入optime(开始网上找的答案是Nullable<DateTime> optime = null发现还是会报错) ......

c# 连接MySql数据库的两种方法

1、用MySQLDriverCS连接MySQL数据库
先下载和安装MySQLDriverCS,地
址:
http://sourceforge.net/projects/mysqldrivercs/
在安装文件夹下面找到
MySQLDriver.dll
,然后将
MySQLDriver.dll
添加引用到项目中
注:我下载的是版本是

MySQLDriverCS-n-EasyQueryTools-4.0.1-DotNet2.0.exe
 
using

S ......

asp.netc#Access通用数据访问类

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// Data ......

C#语言 第四部分 图形界面编程(五) 布局容器类(1)

从ContainerControl类继承的子类作为容器窗体,可以容纳除Form类对象外的其余窗体对象。
在所有容器窗体内,最基本的就是顶级容器Form类以及面板容器Panel类。这两者的主要区别为:前者具有Windows标准框架(标题栏,最大化、最小化和关闭按钮,窗体边框,可调整尺寸),并且可以独立存在;后者只是一块区域,并且必须依附 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号