在C#中反转单词数组

在c#中如何倒置单词数组示例

namespace demo_arraylist
{

    class Program
    {
        static void Main(string[] args)
        {

            //Program that uses Array to Revers Word
            const string s1 = "This is Reverse word";   
            string rev1 = Words.RWords(s1);
            Console.WriteLine(rev1);

            Console.ReadKey();
        }
        //This is a method of Reverse
        static class Words

        {
            public static string RWords(string strword)
            {
                string[] words = strword.Split(' ');

                Array.Reverse(words);
                return string.Join(" ", words);
            }
        }

    }
}
日期:2020-04-11 23:03:50 来源:oir作者:oir