Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# get last item in list

using System.Linq; // make sure to use System.Linq

List<string> list = new List<string>
{
	"one",
	"two",
	"three",
};
var lastItem = list.LastOrDefault();
//Or
var lastItem = list.Last();
Comment

c# get the last item in a list

var lastItem = integerList.Last();
Comment

c# list get last element

var lastItem = someList{^1];
Comment

f# get last element of list

Seq.last lst
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity rotation 
Csharp :: unity create a child object 
Csharp :: know to which direction Vector.MoveTowards is moving unity 2D 
Csharp :: c# write byte[] to stream 
Csharp :: Razor foreach loop 
Csharp :: c# messagebox yes no "wpf" 
Csharp :: c# base64 encode 
Csharp :: swaggergen add service not getting info in .net core 
Csharp :: error provider c# 
Csharp :: convert iformfile to byte array c# 
Csharp :: unity 2d movement 
Csharp :: cast int to enum type c# 
Csharp :: listview item click c# 
Csharp :: how to get hours and minutes from second in c# 
Csharp :: unity vscode no autocomplete 
Csharp :: list removeall unity 
Csharp :: how to get the hour on c# 
Csharp :: c# string replace comma with newline 
Csharp :: c# datagridview cell click event 
Csharp :: if in dictionary c# 
Csharp :: convert string to int c# 
Csharp :: selection sort in c# 
Csharp :: c# reflection resize array 
Csharp :: inline creation dictionnary C# 
Csharp :: Throw index out of range C# 
Csharp :: linear search c# 
Csharp :: how to convert date to Complete ISO-8601 date in c# 
Csharp :: regex c# 
Csharp :: c# turn negative number into positive 
Csharp :: remove items from one list in another c# 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =