You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

IEnumerableExtensions.cs 480 B

123456789101112131415161718192021
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. namespace LLama.Extensions
  4. {
  5. internal static class IEnumerableExtensions
  6. {
  7. #if NETSTANDARD2_0
  8. public static IEnumerable<T> TakeLast<T>(this IEnumerable<T> source, int count)
  9. {
  10. var list = source.ToList();
  11. if (count >= list.Count)
  12. return list;
  13. list.RemoveRange(0, list.Count - count);
  14. return list;
  15. }
  16. #endif
  17. }
  18. }