Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: Bluetooth programming Pin
Giorgi Dalakishvili2-Feb-10 23:05
mentorGiorgi Dalakishvili2-Feb-10 23:05 
QuestionWhen To Use 'this' in C# Pin
Matt U.2-Feb-10 8:15
Matt U.2-Feb-10 8:15 
AnswerRe: When To Use 'this' in C# Pin
Abhinav S2-Feb-10 8:21
Abhinav S2-Feb-10 8:21 
AnswerRe: When To Use 'this' in C# Pin
OriginalGriff2-Feb-10 8:25
mveOriginalGriff2-Feb-10 8:25 
GeneralRe: When To Use 'this' in C# Pin
Matt U.2-Feb-10 10:55
Matt U.2-Feb-10 10:55 
AnswerRe: When To Use 'this' in C# Pin
Ennis Ray Lynch, Jr.2-Feb-10 8:25
Ennis Ray Lynch, Jr.2-Feb-10 8:25 
GeneralRe: When To Use 'this' in C# Pin
Kevin McFarlane2-Feb-10 10:32
Kevin McFarlane2-Feb-10 10:32 
GeneralRe: When To Use 'this' in C# Pin
DaveyM692-Feb-10 12:28
professionalDaveyM692-Feb-10 12:28 
Kevin McFarlane wrote:
A lot of MS's generated code uses this.xxx


A FormX.Designer.cs is full of it. I guess the principles are:

1. In a container (such as a form) that holds many different objects, explicitly stating the object that you are using a method or property of is probably good practice and leaves no room for ambiguity.

2. It allows for parameters and fields to have the same name (much more likely to occur in auto generated code). If you always access the field with this then there will be no issues in this situation.

Personally, I only use it in my hand written code in case 2 and only where needed.

Dave

Tip: Passing values between objects using events (C#)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: When To Use 'this' in C# Pin
Kevin McFarlane3-Feb-10 0:08
Kevin McFarlane3-Feb-10 0:08 
GeneralRe: When To Use 'this' in C# Pin
Mycroft Holmes2-Feb-10 12:08
professionalMycroft Holmes2-Feb-10 12:08 
GeneralRe: When To Use 'this' in C# Pin
AspDotNetDev2-Feb-10 17:05
protectorAspDotNetDev2-Feb-10 17:05 
GeneralRe: When To Use 'this' in C# Pin
Luc Pattyn2-Feb-10 17:17
sitebuilderLuc Pattyn2-Feb-10 17:17 
AnswerRe: When To Use 'this' in C# Pin
PIEBALDconsult2-Feb-10 12:37
mvePIEBALDconsult2-Feb-10 12:37 
QuestionHelp with Drawing Polygons Pin
Raztor02-Feb-10 7:51
Raztor02-Feb-10 7:51 
AnswerRe: Help with Drawing Polygons Pin
Luc Pattyn2-Feb-10 8:18
sitebuilderLuc Pattyn2-Feb-10 8:18 
GeneralRe: Help with Drawing Polygons Pin
Raztor02-Feb-10 8:24
Raztor02-Feb-10 8:24 
GeneralRe: Help with Drawing Polygons Pin
Luc Pattyn2-Feb-10 8:26
sitebuilderLuc Pattyn2-Feb-10 8:26 
GeneralRe: Help with Drawing Polygons Pin
Raztor02-Feb-10 8:30
Raztor02-Feb-10 8:30 
GeneralRe: Help with Drawing Polygons Pin
Raztor02-Feb-10 8:40
Raztor02-Feb-10 8:40 
QuestionTAPI Platform Invoking Pin
saeidfarahi2-Feb-10 7:44
saeidfarahi2-Feb-10 7:44 
AnswerRe: TAPI Platform Invoking Pin
DaveyM692-Feb-10 7:49
professionalDaveyM692-Feb-10 7:49 
QuestionHow to add an attribute to a XML node Pin
Petri Luoto2-Feb-10 6:24
Petri Luoto2-Feb-10 6:24 
AnswerRe: How to add an attribute to a XML node Pin
Dan Mos2-Feb-10 7:06
Dan Mos2-Feb-10 7:06 
AnswerRe: How to add an attribute to a XML node Pin
Not Active2-Feb-10 7:46
mentorNot Active2-Feb-10 7:46 
GeneralRe: How to add an attribute to a XML node Pin
Petri Luoto2-Feb-10 8:24
Petri Luoto2-Feb-10 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.