示例#1
0
    static void Main()
    {
        const string s1 = "Bill Gates is the richest man on Earth";
        const string s2 = "Srinivasa Ramanujan was a brilliant mathematician";

        // In the Main() method, the rev1/rev2 string variables will
        // call the WordTools class and its .ReverseWords() method
        // and applied to both s1 and s2 strings that were declared
        // and assigned the beginning of the method. 'rev1' and 'rev2'
        // are introduced as new variables because the original s1
        // and s2 were declared as constant strings.
        string rev1 = WordTools.ReverseWords(s1);

        Console.WriteLine(rev1);

        string rev2 = WordTools.ReverseWords(s2);

        Console.WriteLine(rev2);
    }
        private string Reverse()
        {
            string str = txtEnter.Text;

            return(txtReverse.Text = WordTools.ReverseWords(str.ToString()));
        }