Remove last x elements from the list
Now we have the option
void List<T>.RemoveRange(int index, int count);
See Microsoft Docs List.RemoveRange(Int32, Int32) Method for Core
Microsoft Docs List.RemoveRange(Int32, Int32) Method for Framework 4.8
Applies To
.NET Core 3.1 3.0 2.2 2.1 2.0 1.1 1.0
.NET Framework 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6 4.5.2 4.5.1 4.5 4.0 3.5 3.0 2.0
.NET Standard 2.1 2.0 1.6 1.4 1.3 1.2 1.1 1.0
No, there isn't... But if you want you can put it in an extension method.
static class ListEx
{
public static void RemoveFrom<T>(this List<T> lst, int from)
{
lst.RemoveRange(from, lst.Count - from);
}
}