tsunami

log in
history

C#: extension methods

Luke Breuer
2010-12-30 21:39 UTC
tags: c# code

static class ExtensionMethods
{
    public static string Nullify(this string s)
    {
        return string.IsNullOrEmpty(s) ? null : s;
    }

    public static string Join(this IEnumerable<string> strings, string delimiter)
    {
        return string.Join(delimiter, strings as string[] ?? strings.ToArray()).Nullify();
    }
}