日期:2014-05-18  浏览次数:20423 次

如何不区分大小写??
Hashtable   ht   =   new   Hashtable();

ht[ "Name "]   =   "yuna ";
ht[ "Pass "]   =   "123456 ";

if(ht.ContainsKey( "name "))  
{
Response.Write(ht[ "name "].ToString());
}

//   只要是name   不管大小写都能输出,怎么做到??


------解决方案--------------------
明显不严谨。。这么做有什么好处呢?
------解决方案--------------------
存进去的时候都小写或大写
读取的时候转换成小写或大写

Hashtable ht = new Hashtable();

ht[ "Name ".ToLower()] = "yuna ";
ht[ "Pass ".ToLower()] = "123456 ";

if(ht.ContainsKey( "name "))
{
Response.Write(ht[ "name "].ToString());
}