METHOD

Array.Empty<T>

Returns a zero-length array of the selected element type. It is non-null and foreach over it has zero iterations. Do not rely on object identity or a fresh allocation per call.

Formal Syntax & Structure

csharp syntaxcsharp
Array.Empty<int>()

Working Example

Example Snippetcsharp
using System;Console.WriteLine(Array.Empty<int>().Length); // 0
C# & .NET Reference