SortedDictionary (C#)-更改值
在 SortedDictionary 中,是否可以更改项目的值?
In a SortedDictionary is it possible to change the value of an item ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
在 SortedDictionary 中,是否可以更改项目的值?
In a SortedDictionary is it possible to change the value of an item ?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
是的,为什么不?
Yes, why not?
是的,只需像这样使用索引器(在 C# 中):
Yes, just use the indexer like this (in C#):
您可以更改值和键,根据定义键是排序的(添加时)
要更改键,请将值存储在临时值中,删除键,然后使用临时值添加新键。
you can change values and keys, by definition keys are sorted (when adding)
To change a key, store value in a temp, remove the key, and Add the new key with the temp value.