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

C#

 
GeneralBluetooth programming Pin
Jamal Abdul Nasir2-Feb-10 8:31
Jamal Abdul Nasir2-Feb-10 8:31 
GeneralRe: Bluetooth programming Pin
Ennis Ray Lynch, Jr.2-Feb-10 8:35
Ennis Ray Lynch, Jr.2-Feb-10 8:35 
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 
Unfortunately, this is a suggested requirement of FXCOP and it is a very poor programming practice. It is my opinion that the over-user of the this keyword came from ignorant programmers who did not know of the keyboard shortcut for intellisense (ctrl + space) these ignorant programmers then went on to define a standard because they wanted code to be "readable" thus it became a standard. It then made it into FXCOP which is a MS tool and then, because it is an MS tool other companies "architects" decided that if MS does it then it must be good. However, MS code rarely, if ever passed through the recommended FXCOP settings without warnings ... to make a long story short:

Don't use this unless you really need to. The only real good time to use the keyword is when calling a method from another object that required a reference to the calling object such as:

public class Foo{

    public Foo(){
        Bar bar = new Bar(this);
    }
}
public class Bar{
    public Bar(Foo foo){}
}


In all other cases where you would be tempted to use the keyword you have inappropriately named your local and member variables. Fix them.


Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting.

A man said to the universe:
"Sir I exist!"
"However," replied the universe,
"The fact has not created in me
A sense of obligation."
--Stephen Crane


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 
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 

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.