Automatic Properties
-
Hi, If you use an automatic property and want to reference it within the same class I assume you would specify the property but if you had another property within the same class that required validation you would reference the field. Don't you think this is messy code?
private string _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get; set; } public void Foo() { string test = _firstName + LastName; }
modified on Thursday, March 6, 2008 5:29 AM
-
Hi, If you use an automatic property and want to reference it within the same class I assume you would specify the property but if you had another property within the same class that required validation you would reference the field. Don't you think this is messy code?
private string _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get; set; } public void Foo() { string test = _firstName + LastName; }
modified on Thursday, March 6, 2008 5:29 AM
tell me, is the following so hard to understand :
Please do not post programming questions here
moreover, you were already been told so in one of your previous questions XLINQ. so, no excuse man :zzz:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Hi, If you use an automatic property and want to reference it within the same class I assume you would specify the property but if you had another property within the same class that required validation you would reference the field. Don't you think this is messy code?
private string _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get; set; } public void Foo() { string test = _firstName + LastName; }
modified on Thursday, March 6, 2008 5:29 AM
On 15th Dec 2007 you were told not to post programming questions[^] in the Lounge.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
On 15th Dec 2007 you were told not to post programming questions[^] in the Lounge.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
On 15th Dec 2007 you were told not to post programming questions[^] in the Lounge.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Rajesh R Subramanian wrote:
15th Dec 2007
That was on 15th December 2007. Today is not 15th December 2007. Today it is 6th March 2008. Your system clock is very slow. You may need to replace your CMOS.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
Please forgive me! I apologies for innocently posting a programming related question in the wrong forum on a programming website. :(( :(( :(( :(( :(( :(( :((
GChannon wrote:
innocently
How do you trip down so frequently? Assume you are elecrocuted today accidentally by stamping over a live electric wire. Ten days down the line, would'nt you be more careful when you are repairing an electric appliance?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
On 15th Dec 2007 you were told not to post programming questions[^] in the Lounge.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hi, If you use an automatic property and want to reference it within the same class I assume you would specify the property but if you had another property within the same class that required validation you would reference the field. Don't you think this is messy code?
private string _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get; set; } public void Foo() { string test = _firstName + LastName; }
modified on Thursday, March 6, 2008 5:29 AM
Anonymous properties are a convenience. Don't abuse them - be consistent with your approach to them.
Deja View - the feeling that you've seen this post before.