Hi, I'm just getting started with C#, so excuse this question
It's my understanding that
works just like
I know that the first way is preferred, and I half understand why.
My question is, do I really have to write 4 lines of code everytime I want to declare a public variable? There must be an easier way to do this. Something cute like
obviously that doesn't work, but something to save my carpul tunnel syndrom?
I heard some programmers get paid by the line, they must love this new construct huh?
I'm joking a little, but this is a serious question. I did search around for a while on google groups, and I found a lot of people talking about how the property is the preferd way to go with C#, but not a simpeler way to code it.
Thanks for your time,
CJB
It's my understanding that
Code:
private string mnfParNum;
public string MnfParNum
{
get{return mnfParNum;}
set{mnfParNum = value;}
}
Code:
public string MnfParNum;
I know that the first way is preferred, and I half understand why.
My question is, do I really have to write 4 lines of code everytime I want to declare a public variable? There must be an easier way to do this. Something cute like
Code:
private property string mnfParNum
I heard some programmers get paid by the line, they must love this new construct huh?
I'm joking a little, but this is a serious question. I did search around for a while on google groups, and I found a lot of people talking about how the property is the preferd way to go with C#, but not a simpeler way to code it.
Thanks for your time,
CJB