Question by
colourcrisis · Dec 03, 2018 at 01:54 PM ·
c#liststringdictionary
Insert string into empty list at a specific index
I realise that if my list is empty, I can't insert something at the 3rd index for example as it will return an out of bounds error.
So I tried to pad my list with null values. So if I wanted to insert something at the 3rd index, element 1 and 2 will be null to achieve this. But this seems so unnecessary... I was wondering if there were any alternatives or ways around this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612183236im_/https://answers.unity.com/themes/thub/images/avi.jpg)