Closed
Description
Background and motivation
Add IsEmpty Linq extension property as discussed here: https://build.microsoft.com/en-US/sessions/BRK114?source=sessions (t=28:40)
API Proposal
namespace System.Linq;
public static partial class Enumerable
{
extension<T>(IEnumerable<T> source)
{
public bool IsEmpty { get; }
}
}
API Usage
List<int> mycollection = new();
Console.WriteLine(mycollection.IsEmpty);
Alternative Designs (EDITED)
namespace System.Linq;
public static partial class Collections
{
extension<T>(ICollection<T> source)
{
public bool IsEmpty { get; }
}
}
Risks
Cluttering the API.