I'd like to replace all null value in my List<string> but if don't want to do a foreach loop.
List<string> tmpList = new List<string>();
//src is a List<string> where I want to remplace the null by "NULL"
foreach(string s in src)
{
if(s == null)
{
tmpList.Add("NULL");
}
else
{
tmpList.Add(s);
}
}
src = tmpList;
Do you know a better way to do this ? With LINQ may be ?
for (int i = 0; i < src.Count; i++) src[i] = src[i] ?? "NULL";