Click here to Skip to main content
15,898,036 members
Home / Discussions / C#
   

C#

 
GeneralRe: Direct X 9 ID3 tags ? Pin
Christian Graus4-Aug-04 10:54
protectorChristian Graus4-Aug-04 10:54 
GeneralRe: Direct X 9 ID3 tags ? Pin
leppie3-Aug-04 19:12
leppie3-Aug-04 19:12 
GeneralAlignment of listview Pin
Christian Graus2-Aug-04 10:56
protectorChristian Graus2-Aug-04 10:56 
GeneralRe: Alignment of listview Pin
beowulfagate2-Aug-04 13:59
beowulfagate2-Aug-04 13:59 
GeneralMulti-Column What Pin
Peter86753092-Aug-04 7:41
Peter86753092-Aug-04 7:41 
GeneralRe: Multi-Column What Pin
Nick Parker2-Aug-04 8:52
protectorNick Parker2-Aug-04 8:52 
GeneralRe: Multi-Column What Pin
Peter86753092-Aug-04 9:42
Peter86753092-Aug-04 9:42 
Question"Bad Form" to use public class variables without get & set? Pin
ThomasH12-Aug-04 7:06
ThomasH12-Aug-04 7:06 
Hey everyone, just wondering what your thoughts are on Get & Set! I've got a class in which I have two public variables. The class itself changes their values, and any calling class can also change the values.

Is it "bad form" to just leave these variables public? Or should I turn these into class properties by doing:

private int _myvar;

public int myvar
{
  get
  {
    return _myvar;
  }
  set
  {
    _myvar = value;
  }
}


The class is so specialized that I don't need to do any checking during a "set" when I call the class methods. My instinct says that I'd get a microsecond or two of a performance boost by just leaving myvar as public, and eliminating the private/get/set/propery code. But I'm curious as if to this is bad form.

I could see if I had to prevent a "set" operation, or perform a check on the value first- but I don't have to do either of these.

Thanks!

-Thomas
AnswerRe: "Bad Form" to use public class variables without get & set? Pin
Steven Campbell2-Aug-04 7:38
Steven Campbell2-Aug-04 7:38 
GeneralRe: "Bad Form" to use public class variables without get & set? Pin
Judah Gabriel Himango2-Aug-04 8:05
sponsorJudah Gabriel Himango2-Aug-04 8:05 
GeneralRe: "Bad Form" to use public class variables without get & set? Pin
ThomasH12-Aug-04 9:16
ThomasH12-Aug-04 9:16 
GeneralRe: "Bad Form" to use public class variables without get & set? Pin
Nemanja Trifunovic2-Aug-04 8:18
Nemanja Trifunovic2-Aug-04 8:18 
GeneralRe: "Bad Form" to use public class variables without get & set? Pin
Nick Parker2-Aug-04 8:48
protectorNick Parker2-Aug-04 8:48 
QuestionHow to change error icon shown in datagrid cells Pin
Kasdoffe2-Aug-04 5:43
Kasdoffe2-Aug-04 5:43 
Generalservices with gui Pin
elraton2-Aug-04 5:26
elraton2-Aug-04 5:26 
GeneralRe: services with gui Pin
Colin Angus Mackay2-Aug-04 8:12
Colin Angus Mackay2-Aug-04 8:12 
GeneralCustom Control leaps to 0,0 on F5 Pin
ddelapasse2-Aug-04 5:26
ddelapasse2-Aug-04 5:26 
GeneralProblem with string.Replace() and antislashes... Pin
polkiujhy2-Aug-04 4:58
polkiujhy2-Aug-04 4:58 
GeneralRe: Problem with string.Replace() and antislashes... Pin
Michael P Butler2-Aug-04 6:15
Michael P Butler2-Aug-04 6:15 
GeneralCuston TrackBar Pin
Guinness4Strength2-Aug-04 4:11
Guinness4Strength2-Aug-04 4:11 
GeneralRe: Custon TrackBar Pin
leppie2-Aug-04 4:16
leppie2-Aug-04 4:16 
GeneralRe: Custon TrackBar Pin
Guinness4Strength2-Aug-04 9:22
Guinness4Strength2-Aug-04 9:22 
GeneralRe: Custon TrackBar Pin
Guinness4Strength2-Aug-04 9:34
Guinness4Strength2-Aug-04 9:34 
GeneralPropertyGrid Pin
blankg2-Aug-04 2:03
blankg2-Aug-04 2:03 
GeneralRe: PropertyGrid Pin
Nick Parker2-Aug-04 3:35
protectorNick Parker2-Aug-04 3:35 

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.