new System.Type[0]
as Type.EmptyTypes
CS-R1077The System.Type
class represents classes, interfaces, arrays, enums, and other types. In case you wish to create an empty array whose type is System.Type
, consider using Type.EmptyTypes
as it is a static
, readonly
field inside the System.Type
class. Doing it this way reduces the number of allocations and exerts less pressure on GC.
var emptyTypes = new System.Type[0];
var emptyTypes = Type.EmptyTypes;