2/8/2015 7:25:25 PM

The Coalesce function with take a series of strings and return the first one that is not null or an empty string.

public static string Coalesce(params string[] values) { if (values == null) { //could also default to "" return null; } for (int x = 0; x < values.Length; x++) { if (!string.IsNullOrEmpty(values[x])) { return values[x]; } } //could also default to "" return null; }