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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:33:42+00:00 2026-05-22T19:33:42+00:00

I come from C++ and normally this is rarely used compared to C#. In

  • 0

I come from C++ and normally this is rarely used compared to C#. In my experience, the usage of this is strictly limited to scope and/or name resolution.

I have coworkers that insist that using this everywhere makes code “more clear”. They essentially depend on it for documentation purposes. I disagree with this usage as it is very subjective, redundant, and practically useless as far as documentation is concerned.

There are cases where I see this.myClassVariable = 100;. In this case, this serves no real use other than (according to my coworkers) to make it very clear that myClassVariable is not a static. This is just one example.

Personally, where ever there are no ambiguities, I use myClassVariable = 100;. This is more clear and I feel honestly that if your variables are well named, code will be self documenting and ‘this’ is not needed.

What is the general rule of thumb on using ‘this’? I’m asking for use cases that go beyond the obvious requirements (such as resolving ambiguities). There are cases where the usage of this is required for code to compile and I’m not necessarily interested in those cases. How do you guys feel about using this for documentation?

  • 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-22T19:33:43+00:00Added an answer on May 22, 2026 at 7:33 pm

    If they want to distinguish static variables from private instance variables, why not use a naming convention to distinguish the two, instead of requiring this? For example, for private instance variables, prefix them with an underscore and name them using camel case (e.g. _myVariable). Then, for static variables, use Pascal case with no prefix (e.g. MyStaticVariable). It allows for simple disambiguation between static and instance variables, and doesn’t require the extra key strokes and general “ugliness” required for this.

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

Sidebar

Related Questions

I come from the iPhone development world but have never developed desktop applications. Now
I come from a background where I normally create one file per class. I
I'm new to WPF and come from a WinForms background and have a fairly
I normally come here if google doesnt work. So this time it goes like
I come from the Java world, so to me it's all object.foo() , but
I come from a Java background and am getting more into .NET, what are
I come from ruby/C# and am new to Python. I'm looking at the following
I come from a C++ background and I've been working with C# for about
I come from the asp.net world where we'd use an objectdatasource, hooked up to
I come from a php background and in php, there is an array_size() function

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.