Aller au contenu

Symbol and its member assigned together (CA2246)

Ce contenu n’est pas encore disponible dans votre langue.

Key dotnet.codequality.symbol-member-same-statement · Severity warning · Category codequality

Microsoft analyzer CA2246. Flags a statement that assigns a variable and one of its members at once (a = a.Next = x). The member is set on the old object, which is rarely what was meant.

node = node.Next = candidate;
node.Next = candidate;
node = candidate;