Something I find myself doing more and more is checking a string for empty (as in \"\" or null) and a conditional operator.
A current example:
I know this is an old question - but I was looking for an answer and none of the above fit my need as well as what I ended up using:
private static string Coalesce(params string[] strings)
{
return strings.FirstOrDefault(s => !string.IsNullOrEmpty(s));
}
Usage:
string result = Coalesce(s.SiteNumber, s.AltSiteNumber, "No Number");
EDIT: An even more compact way of writing this function would be:
static string Coalesce(params string[] strings) => strings.FirstOrDefault(s => !string.IsNullOrEmpty(s));