forum

Home / DeveloperSection / Forums / Insert inside list in C#

Insert inside list in C#

Takeshi Okada 2577 25-Jan-2014

I am initializing my list as below -

 List<string> lFiles = new List<string>(12);

and now I want to add/insert my string at specific index.

like I am using below -

 lFiles.Insert(6,"File.log.6");

it it throwing excepton as - "Index must be within the bounds of the List."

While initializing I have declared capacity of List but still I am not able insert strings at random indexes.

Anybody knows what I am missing??


c# c# 
Updated on 25-Jan-2014

Can you answer this question?


Answer

1 Answers

Liked By