mrb*_*lah 4 c# dictionary
我正在努力做到
myDic.TryGetValue("username",out user.Username);
但它不起作用.
这不可能吗?
Joh*_*nan 9
不,来自文档:
"属性不是变量,因此不能作为out参数传递."
http://msdn.microsoft.com/en-us/library/t3c3bfhx.aspx
G-W*_*Wiz 6
要继续约翰的回答,请改为:
string username; if (myDic.TryGetValue("username", out username)) { user.Username = username; }
归档时间:
16 年,6 月 前
查看次数:
1922 次
最近记录: