ReverseWords

public static string ReverseWords(this string sentence)
        {
            var words = sentence.Split(' ');
            Array.Reverse(words);
            //string reversed = words.Aggregate((workingSentence, next) => next + " " + workingSentence);

            return string.Join(" ", words);
        }
Example:
var sentence = "the quick brown fox jumps over the lazy dog";
sentence.ReverseWords();

Description

Reverse Words

Details

Double click on the code to select all.

 

;