Check out example codes for "get last element of array c#". It will help you in understanding the concepts better.

Code Example 1

using System;

public class Demo {
   public static void Main() {
      string[] str = new string[] {
         "Java",
         "HTML",
         "jQuery",
         "JavaScript",
         "Bootstrap"
      };
      Console.WriteLine("Array...");
      foreach(string res in str) {
         Console.WriteLine(res);
      }
      Console.WriteLine("Last element: "+str[str.Length - 1]);
   }
}

Code Example 2

string[] str = new string[] {"Java","HTML","jQuery"};
Console.WriteLine("Last element: "+str[str.Length - 1])

Learn ReactJs, React Native from akashmittal.com