C#

C#

Made by DeepSource

Consider using Clear() to set the items in a Span<T> to their default values CS-P1023

Performance
Major
Autofix

The Fill() method fills Span<T> with the value specified. However, consider using the Clear() method instead if you wish to set the items to the default values as it is more performant and designed for this exact purpose.

Bad Practice

span.Fill(0);

Recommended

span.Clear();

Reference