我声明字典如下:
private Dictionary<int, touchInformation> touchDictionary = new Dictionary<int, touchInformation>();
Run Code Online (Sandbox Code Playgroud)
我使用如下:
touchDictionary[touchID] = touchObject;
因此,touchDictionary将保留来自touchID的密钥.现在,我尝试使用字典找到最小密钥,但我不知道该怎么做.有什么建议吗?
请注意,C.Porawat
Col*_*inE 20
Dictionary具有Keys属性,允许您枚举字典中的键.您可以使用Min Linq扩展方法获取最小密钥,如下所示:
int minimumKey = touchDictionary.Keys.Min();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11473 次 |
| 最近记录: |