Zum Inhalt springen

ToImmutable on an immutable collection (CA2009)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key dotnet.performance.redundant-toimmutable · Severity info · Category performance

Microsoft analyzer CA2009. Flags ToImmutableArray/ToImmutableList and friends called on a collection that already is one.

ImmutableArray<string> names = GetNames().ToImmutableArray();
var copy = names.ToImmutableArray();
ImmutableArray<string> names = GetNames().ToImmutableArray();
var copy = names;