get last element of array csharp

Code Example - get last element of array csharp

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

csharp get last array element

                        
                                string[] items = GetAllItems();
string lastItem = items[items.Length - 1];
int arrayLength = array.Length;
                            
                        
 

csharp array last element

                        
                                int[] array = { 1, 3, 5 };
var lastItem = array[^1]; // 5
                            
                        
 

take the last 50 from array csharp

                        
                                //get last element of array c#
string[] str = new string[] {"Java","HTML","jQuery"};
Console.WriteLine("Last element: "+str[str.Length - 1])
//c# get last array element
string[] items = GetAllItems();
string lastItem = items[items.Length - 1];
int arrayLength = array.Length;