Dictionary通过下标获取key和value
Posted yinmu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dictionary通过下标获取key和value相关的知识,希望对你有一定的参考价值。
Dictionary<int, string> dic = new Dictionary<int, string>(); Dictionary<int, string>.Enumerator en = dic.GetEnumerator(); for (int i = 0; i < dic.Count; i++) { if (en.MoveNext()) { int key = en.Current.Key; string value = en.Current.Value; } }
以上是关于Dictionary通过下标获取key和value的主要内容,如果未能解决你的问题,请参考以下文章
C# 如何通过Key键获取Dictionary集合内的Value
Python 基础 - Day 2 Learning Note - Dictionary 字典