Thursday, May 28, 2015

Remove blank values from array in C#


Test = test.Where(x => !string.IsNullOrEmpty(x)).ToArray();

var temp_n = new List<string>();
foreach (var s in test)
{
if (!string.IsNullOrEmpty(s))
temp_n.Add(s);
}
Test = temp_n.ToArray();

No comments:

Post a Comment