What's Wrong with this?(devblog.ailon.org)

submitted by ailonailon(1335) 3 years, 11 months ago

Every time I read a C# book or an article or just a code sample in MSDN I can't stop wondering why don't people use this qualifier unless it's absolutely required? What do we sacrifice code readability for?

3 comments |category: |Views: 673

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by JudahGabrielJudahGabriel(814) 3 years, 11 months ago 0

FWIW, the recently released Microsoft StyleCop tool reports violations if you fail to use the 'this' keyword in front of member accesses.

Reply

posted by senfosenfo(881) 3 years, 11 months ago 0

I haven't used StyleCop ( yet), but I rarely use "this" unless I need to because it looks ugly. Also, I've never found it easier to read code without it being used. But that's just me. ;)

Reply

posted by rprouserprouse(1175) 3 years, 11 months ago 0

Interestingly, Resharper flags usages of this as a style warning. It considers it redundant. Personally, I like this because it makes it immediately obvious that the variable is not local.

Reply

information Login or create an account to comment on this story