Vote count: 3
I have a list of strings List<string> blobsToCopy
var newList = blobsToCopy.Select(GetDiskNameWithoutFolder);
private static string GetDiskNameWithoutFolder(string path) {...}
How to change all values in the blobsToCopy without creating a new IEnumerable<string>?
asked 4 mins ago
2 Answers
Vote count: 4
You don't use LINQ, just use a simple for loop and replace each item with your modified item.
for (var i = 0; i < blobsToCopy.Count; i++)
{
blobsToCopy[i] = GetDiskNameWithoutFolder(blobsToCopy[i]);
}
answered 1 min ago
Vote count: 1
Unless I'm missing something obvious, what's wrong with a good old-fashion for loop?
for(var i=0; i < blobsToCopy.Count;i++)
{
// do whatever....
}
answered 2 mins ago
برچسب:
نویسنده: استخدام کار
تاريخ: سه
شنبه
18 خرداد
1395 ساعت: 20:10