c# remove last value from list

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

Also in C#: