【发布时间】:2013-03-23 12:35:06
【问题描述】:
我正在寻找类似 PHP 的关联数组,它也支持嵌套。例如,我正在创建一个 Dictionary 对象,如下所示:
System.Collections.Specialized.OrderedDictionary userRoles = new System.Collections.Specialized.OrderedDictionary();
userRoles["UserId"] = "120202";
userRoles["UserName"] = "Jhon Doe";
// 2D array Like
userRoles["UserRoles"][0] = "CAN_EDIT_LIST";
userRoles["UserRoles"][1] = "CAN_EDIT_PAGE";
然后我想通过 KeyNames 而不是索引值来访问它们。有可能吗?
【问题讨论】:
标签: c# ordereddictionary