[dba-VB] C#: this.prefix

Gustav Brock Gustav at cactus.dk
Wed Jul 23 10:40:19 CDT 2008

Hi Shamil et al

Sorry to return to this perhaps pedantic question, but I noticed that the auto generated code in the .Designer.cs files are 100% flooded with either the this. prefix or the full namespace.

Why would the generator do this if it was not necessary? Is it just being overcautious?


>>> shamil at smsconsulting.spb.ru 02-07-2008 18:57 >>>
Hi Gustav,

I almost never use such prefixing - and I did use Me. a lot in VBA...

I do use full namespace prefix if needed.

Using this. prefix could disturb a lot as for C# programming is usual to
make a lot of code refactorings with moving code snippets from here to there

I do use CamelCase postfix naming convention - and it helps and works well
for me (Imagine that after almost ten years of using LNRC (and Hungarian)
naming conventions in VBA and VB6!)...


-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com 
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, July 02, 2008 7:55 PM
To: dba-vb at databaseadvisors.com 
Subject: [dba-VB] C#: this.prefix

Hi all

How rigorously are you prefixing controls and variables with "this."?

Is it a good or bad coding practice to use it when not strictly needed?
Do I understand it right, that it is only needed to separate, say, a method
in the current namespace from an identically named and public method in
another namespace?

I've found, that I use it a lot - old habit from "Me." in VBA, I guess.


More information about the dba-VB mailing list