score:9

Accepted answer

just use a regular for loop - that's the simplest way of modifying the collection:

for (int i = 0; i < list.count; i++)
{
    string url = list[i];
    if (!url.startswith("http://"))
    {
        list[i] = "http://" + url;
    }
}

if you're happy to create a new collection, it's simple:

var modifiedlist = list.select(url => url.startswith("http://") ? url : "http://" + url)
                       .tolist();

score:1

another way to do this by using union is:

var result =
    list.where(url => url.startswith("http://"))
        .union(list.where(url => !url.startswith("http://")).select(url => $"http://{url}"))
        .tolist();

score:3

yourlist.where(_ => !_.startswith("http://")).tolist().foreach(_ => _.insert(0, "http://"));

Related Query

More Query from same tag