c#键值对能存进数组里吗
时间: 2024-02-02 16:04:46 浏览: 102
c#泛型序列化对象为字节数组的示例
回答: 是的,C#中的键值对可以存进数组里。你可以使用Dictionary<TKey, TValue>类来创建键值对集合,然后将该集合存储在数组中。例如,你可以创建一个Dictionary<string, int>类型的键值对集合,然后将该集合存储在一个数组中。你可以使用foreach循环来遍历数组中的键值对,并访问每个键和值。\[2\]\[3\]
#### 引用[.reference_title]
- *1* [c#集合_键值对Dictionary & SortedList](https://blog.csdn.net/weixin_65243968/article/details/129770176)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [C# 键值对](https://blog.csdn.net/u014453443/article/details/107917183)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [C#键值对](https://blog.csdn.net/qq_50563014/article/details/118115452)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文