C#

C#

Made by DeepSource

Properties should not return collections' clone CS-P1026

Performance
Major

Properties are different than fields and are expensive in terms of performance in some scenarios. It is always recommended that properties not clone and return collections. If you absolutely have to do so, consider turning them into methods.

Bad Practice

public int[] Even => (int[]) _even.Clone();

Recommended

public int[] Even() => (int[]) _even.Clone();