Showing posts with label insert item at specific position in list. Show all posts
Showing posts with label insert item at specific position in list. Show all posts

Add Item to a list at given position (Insert item in list) in c#

In this post am going to explain how to add new item to a list at specific position.

You can add items to a list using myList.add("some thing"). but this adds that item as the last item in that list.

If you want to add a item at a specific position or if you want to insert a item into a list you can do it like below,

myList.insert(position, item);

Ex: myList.insert(2, item) --> i am inserting this item at position 2.

Read more...