33
Define an extension method:
static string Or(this string value, string alternative) {
return string.IsNullOrEmpty(value) ? alternative : value;
}
Now you can say the following:
string result = str1.Or(str2).Or(str3).Or(str4) …
var found = new[]{first, second, third, fourth, fifth}.FirstOrDefault(x =>!String.IsNullOrEmpty(x));