Replacing an element in ICollection

后端 未结 3 947
我在风中等你
我在风中等你 2021-01-20 19:06

Suppose I have an ICollection.

I have the following two variables:

SomeClass old;
SomeClass new;

How

3条回答
  •  半阙折子戏
    2021-01-20 19:45

    The ICollection interface is quite limited, you will have to use Remove() and Add()

    collection.Remove(old);
    collection.Add(new);
    

提交回复
热议问题