I have a string array and I need to use the first string in the string array which is not null. Lets consider this code snippet -
string[] strDesc = new string[] {"", "", "test"};
foreach (var Desc in strDesc)
{
if (!string.IsNullOrEmpty(Desc))
{
txtbox.Text = Desc;
break;
}
}
So, according to this code snippet, txtbox should now display "test".
To do this I have this code. This is working fine. But, I want to know if it is possible to use LINQ to obtain the same result and perhaps skip using an extra foreach loop?