ReSharper 2024.2 Help

Code inspection: Auto-property accessor is never used (private accessibility)

This inspection reports private auto-properties that have nominal usages, but may not do anything meaningful because one of their accessors is never used.

Here is an example that illustrates the issue in a simple case:

class Post { // Set in the constructor but never read private string Name { get; set; } // Read once but the value is never set private bool NeedsReview { get; set; } Post(string name) => Name = name; void FlagReview() { if(NeedsReview) Console.WriteLine("Please review"); } }
Last modified: 04 November 2024