If I have the following array of strings:
string[] stringArray = {"one", "two", "three", "four"};
Is there a way to get the first and last item ("one", "four") in C# from the array, besides using array indexing (stringArray[0], stringArray[3]), something like stringArray.First and stringArray.Last ?
Use LINQ First() and Last() methods.
Moreover, both methods have useful overload which allows specifying boolean condition for elements to be considered as first or last.