Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9047771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:59:02+00:00 2026-06-16T11:59:02+00:00

Resharper is suggesting I change the following code to an auto-property. Can anyone explain

  • 0

Resharper is suggesting I change the following code to an auto-property. Can anyone explain why this would be better?

private List<Configuration> _configurations;
public List<Configuration> Configurations
{
    get { return _configurations; }
    set { _configurations = value; }
}

To:

public List<Configuration> Configurations { get; set; }

Why is it okay to do this to primitive types but suggests this way for object types?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:59:04+00:00Added an answer on June 16, 2026 at 11:59 am

    Consider both equivalent pieces of code:

    private List<Configuration> _configurations;
    public List<Configuration> Configurations
    {
        get { return _configurations; }
        set { _configurations = value; }
    }
    

    and

    public List<Configuration> Configurations { get; set; }
    

    To a reader, assuming she is knowledgeable of C#, the second piece code is very quick to read. The first one takes longer and does not add any information. In fact, it adds useless information: I have a property Configurations, but I also have an equivalent field _configurations, and the code in the rest of the class may use any of them, so I have to take them both into account. Now imagine your class has fifteen properties like this one, for instance. Using automatic properties you greatly reduce complexity for whoever is reading the code.

    Besides, if you consistently use automatic properties, whenever you write a non-automatic one the reader is warned immediately that there is something going on there. This useful information is hidden if you don’t use automatic properties.

    In summary, consistent use of automatic properties:

    • Reduces code length
    • Reduces the time needed for reading and understanding a class
    • Hides useless information
    • Makes useful information easier to find

    What’s not to like?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find myself using Resharper's convert to auto property refactoring a lot to remove
Taking the following code, Resharper tells me that voicesSoFar and voicesNeededMaximum cause access to
In resharper I get a blue curly line when for example my private property
Resharper is showing a Possible System.NullReferenceException warning. I however can't see how I can
Using Visual Studio or Resharper, can I jump to the .aspx page while in
I'm writing an add-in for ReSharper 4. For this, I needed to reference several
In using ReSharper recently, it is suggesting I reduce nesting in certain places by
I've noticed ReSharper suggestion under "Common Practices and Code Improvements": Convert local variable or
Resharper has suggested to change from interface IModelMapper<TFrom, TTo> { TTo Map(TFrom input); }
I have the following line of code: var dmrReceived = new DownloadMessagesReport(); StyleCop and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.