Linq style query to change string case in C#

static string toggleStringCase(string input)
{
    return (from c in input select new string(Char.IsLower(c) ? Char.ToUpper(c) : Char.ToLower(c), 1)).Aggregate((a, b) => a += b);
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.