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 549451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:11:09+00:00 2026-05-13T11:11:09+00:00

Ever since I found out about auto properties, I try to use them everywhere.

  • 0

Ever since I found out about auto properties, I try to use them everywhere. Before there would always be a private member for every property I had that I would use inside the class. Now this is replaced by the auto property. I use the property inside my class in ways I normally would use a normal member field. The problem is that the property starts with a capitol, which makes it look a bit weird imho when using it in this manner. I didn’t mind that properties start with a capitol before because they would always be behind a “dot”. Now I have found myself prefixing all the properties I use internally with this., to sooth my feeling.

My dilemma is that before I was always a bit against prefixing all usage of internal members with this., unless “necessary” (like in a setter or constructor). So I am kind of looking for a second opinion on this. Is there a standard good way to do this? Should I just stop complaining (I have the tendency to be a “ant humper” (Dutch expression))?

Before:

class Foo
{
    private Bar bar;
    public Bar Bar { get { return bar; } }

    public Foo(Bar bar)
    {
        this.bar = bar;
    }

    public void DoStuff()
    {
        if(bar != null)
        {
            bar.DoMethod();
        }
    }
}

After:

class Foo
{
    public Bar Bar {get; private set;}

    public Foo(Bar bar)
    {
        this.Bar = bar;
        // or
        Bar = bar;
    }

    public void DoStuff()
    {
        if(this.Bar != null)
        {
            this.Bar.DoMethod();
        }
        // or
        if(Bar != null)
        {
            Bar.DoMethod();
        }
    }
}

Update

It seems that opinions vary, although more people are in favor of prefixing with this.. Before the auto properties I was always pretty much against prefixing with this. instead of in constructors and in setters (as I mentioned before). But now I just don’t know anymore.

Additional note: The fact that it is also common to name the property the same as the class (public Bar Bar { get; private set; }) also makes me tend towards prefixing. Every time I type Bar.DoMethod(), I feel like it looks like a static method. Even though VS would color Bar if it was a static method and you cannot have a static and instance method with the same signature. When it is colored it is clear that it is a static method, but when it is not colored it is not 100% clear that it is not a static method. You could for example just be missing a using statement, but also just because I am not used to having to link the not being colored to whether it’s a static call or not. Before I’d instantly see it by the capitalization of the first letter in case of a member or by the “dot” in case of a property (E.g. the “dot” after foo in (Foo)foo.Bar.DoMethod()).

(Difficult to choose an “Accepted answer” at the moment)

  • 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-05-13T11:11:10+00:00Added an answer on May 13, 2026 at 11:11 am

    Yes, there is a “standard way to do this”: the capital letter and the this-prefix are considered good coding practice. If you use some tool to test your code for coding guidelines like ReSharper or Microsoft’s own StyleCop, it will warn you if not using the this-reference, or if you don’t start your properties with a capital.

    Your properties are publicly visible. Any public property, field or method should start with a capital.

    Any property, field or method that you call inside your own class that is part of that class should be prefixed with the this-reference for ease-of-reading.

    Update: of course, opinions vary. I like hitting this. and then, after the dot, seeing only the members, instead of seeing all keywords when just hitting ctrl-space without any prefix. This helps me. But, in the end (quote from here):

    Whatever your opinion, the important
    thing is that all people closely
    collaborating on a project use the
    same formatting standards,
    irrespective of what those standards
    are.

    More references:
    Microsoft on using a capital letter in almost any name and in properties specifically.
    More guidelines here.

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

Sidebar

Related Questions

Ever since I gained experience at a software house I have found it difficult
Ever since I started using .NET, I've just been creating Helper classes or Partial
Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM : you
Ever since the publication of Enterprise Integration Patterns people have been using the notation
Ever since Microsoft has introduced the application blocks, I've been bumping into people who
Ever since I upgraded to Delphi 2009, I am having terrible experience with TFrame
Ever since deleting the original settings.settings file I have had endless problems getting the
Ever since I installed emacs on a new machine I have seen an ugly
Ever since British Summer Time ended in the UK last week my application has
Ever since I asked how to parse html with regex and got bashed a

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.