This is null safe for Items
in this example. 40x Faster than using ?.Any()
in a microbenchmark when Items is not null but could be empty. In cases where the list will typically be null, ?.Any()
measured about 10x faster, but these are all sub-nanosecond measurements and neither has any allocations.
public class Foo
{
public List<int>? Items { get; set; }