AddRange to a Collection

后端 未结 8 2228
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 11:41

A coworker asked me today how to add a range to a collection. He has a class that inherits from Collection. There\'s a get-only property of that type t

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 11:59

    No, this seems perfectly reasonable. There is a List.AddRange() method that basically does just this, but requires your collection to be a concrete List.

提交回复
热议问题