How to Replace Item In a list?

Does anyone know how I would replace an item in a list? I want to replace an item with null so I can prevent the list from shifting down to fill the removed item. (I am using c#)

Step 1: Find the Index (with IndexOf, for example)
Step 2: Use that value to set that index of the list to null

2 Likes

Thanks, m8, that’s a nice and simple answer. Exactly what I was looking for. :slight_smile:

The code is as simple as myList[index] = null;

1 Like