Unused private member (IDE0051)
Esta página aún no está disponible en tu idioma.
Key dotnet.codequality.unused-private-member · Severity warning · Category codequality
Microsoft code-style analyzer IDE0051. Flags a private method, property or field nothing in the type uses. It is dead code - or a sign that the code meant to call it does not.
Incorrect
Section titled “Incorrect”public class Pricing{ public decimal Total(Order o) => o.Lines.Sum(l => l.Amount);
private decimal Discount(Order o) => o.Total * 0.1m; // never called}Correct
Section titled “Correct”public class Pricing{ public decimal Total(Order o) => o.Lines.Sum(l => l.Amount);}