Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #item #list
ADD COMMENT
Topic
Name
2+7 =