我有一个自定义对象列表,我想更新一个特定元素,比如从顶部开始的第 3 个元素,我该如何在 C# 中执行此操作?
最佳答案
// Updates a property or member of the item
myList[2].myProperty = something;
// Replaces the item in the list
myList[2] = someNewItem;
关于c# - 如何更新 List<T> 元素集合中的特定元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1105411/