How to add item to the beginning of List?

前端 未结 5 1917
太阳男子
太阳男子 2020-12-04 08:17

I want to add a \"Select One\" option to a drop down list bound to a List.

Once I query for the List, how do I add my in

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 08:47

    Use List.Insert

    While not relevant to your specific example, if performance is important also consider using LinkedList because inserting an item to the start of a List requires all items to be moved over. See When should I use a List vs a LinkedList.

提交回复
热议问题