Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# remove last value from list

if(rows.Any()) //prevent IndexOutOfRangeException for empty list
{
    rows.RemoveAt(rows.Count - 1);
}
Comment

C# removing the last value of an array

using System;
using System.Linq;

class RemoveLastElement {
  static void Main() {
    int[] a = { 2, 3, 4, 5, 6};
    int[] result = a.SkipLast(1).ToArray();

    Console.WriteLine(String.Join(",", result));
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# datagridview search filter 
Csharp :: how to make a car in unity 
Csharp :: unity set dropdown value 
Csharp :: C# array index tostring 
Csharp :: crop bitmap image c# 
Csharp :: dictionary c# iterate 
Csharp :: How to create connection string dynamically in C# 
Csharp :: List string to file C# 
Csharp :: c# string to variable name 
Csharp :: how unsort the data table options 
Csharp :: unity find gameobject 
Csharp :: find-text-in-string-with-c-sharp 
Csharp :: create list c# 
Csharp :: c# indexof 
Csharp :: how to store array in c# 
Csharp :: unity c# log an error or warning 
Csharp :: c# latex 
Csharp :: create instance of class given class name string c# 
Csharp :: get enum name 
Csharp :: redirect to another controller page in asp.net core 
Csharp :: c# create list with range 
Csharp :: list index out of range c# 
Csharp :: console.writeline in c# 
Csharp :: c# connect tcp 
Csharp :: c# list length 
Csharp :: jagged array c# 
Csharp :: generate entity model dot net core 
Csharp :: how to run async void function c# 
Csharp :: c# see if string is int 
Csharp :: webclient timeout 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =