关于IDictionary的问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 19:35:56
IDictionary<string, string> di = new Dictionary<string, string>();
di.Add("@UserAccount", strUserName);

问题:我怎么取IDictionary的值

我用以下方法:

Response.Write(di.ToString()+"<br>"+di.Keys+"<br>"+di.Values);

结果出来的:

System.Collections.Generic.Dictionary`2[System.String,System.String]
System.Collections.Generic.Dictionary`2+KeyCollection[System.String,System.String]
System.Collections.Generic.Dictionary`2+ValueCollection[System.String,System.String]

我都看不懂出来的结果是什么

我要取的是最原始strUserName

各位帮帮忙
嘿嘿,自己已经弄出来了
但还是想看看大家的方法,然后送分

IDictionary<string, string> di = new Dictionary<string, string>();
di.Add("UserAccount", "strUserName");
Label1.Text = di["UserAccount"].ToString();

key就是钥匙 必须拿钥匙开门 没钥匙 没辙 ,存东西的时候 自己设的钥匙 ,必须自己知道钥匙,才能拿到东西。