Is there any benefit to declaring a private property with a getter and setter?

Posted by AmoebaMan17 on Stack Overflow See other posts from Stack Overflow or by AmoebaMan17
Published on 2010-04-13T17:37:29Z Indexed on 2010/04/13 17:42 UTC
Read the original article Hit count: 292

Filed under:
|
|

I am reviewing another developer's code and he has written a lot of code for class level variables that is similar to the following:

    /// <summary>
    /// how often to check for messages
    /// </summary>
    private int CheckForMessagesMilliSeconds { get; set; }

    /// <summary>
    /// application path
    /// </summary>
    private string AppPath { get; set; }

Doesn't coding this way add unnecessary overhead since the variable is private?

Am I not considering a situation where this pattern of coding is required for private variables?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#