Get the first and last item of an array of strings

后端 未结 5 1074
既然无缘
既然无缘 2021-02-05 06:35

If I have the following array of strings:

string[] stringArray = {\"one\", \"two\", \"three\", \"four\"};

Is there a way to get the first and l

5条回答
  •  感情败类
    2021-02-05 07:08

    There are stringArray.First() and stringArray.Last() as extension methods in the System.Linq namespace.

提交回复
热议问题