Please stop using new T[0]
to initialize an empty array
If you want an empty enumerable (and I know you should use one), you have Enumerable.Empty
:
var a = Enumerable.Empty<T>();
If you face a case where you really need an empty array, you have Array.Empty
:
var a = Array.Empty<T>();
If Enumerable.Empty
wont work for you and Array.Empty
is not a solution because you are locked in an old .NET version, well fine:
var a = new T[]{};
So please stop using new T[0]
, we are not golfing here.