Limit the size of List(Of T) - VB.NET

后端 未结 5 1844
無奈伤痛
無奈伤痛 2021-01-18 06:46

I am trying to limit the size of my generic list so that after it contains a certain amount of values, it won\'t add any more.

I am trying to do this using the Capac

5条回答
  •  再見小時候
    2021-01-18 07:09

    List has no such facility.

    The capacity stuff is just a performance optimisation.

    You are going to have to roll your own class, derive off list and override the Add implementation.

提交回复
热议问题