Re: property inference
- From: "Peter" <xdzgor@xxxxxxxxxxx>
- Date: Fri, 06 Mar 2009 02:52:29 -0800
Ben Voigt [C++ MVP] wrote:
class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public override string ToString()
{
return this.FirstName + " " + this.LastName;
}
}
question:
so, if you do this type of inference there's no access to the
private variable? is that correct?
What inference? What private variable? The code you posted has
neither.
I guess the compiler "infers" that the properties FirstName and
LastName should have a private backing variable, and that it should
generate the code to support getting and setting these values?
(This use of the term "inference" of course conflicts with another,
usual, use of the term "inference" in c#).
.
- References:
- property inference
- From: rodchar
- Re: property inference
- From: Ben Voigt [C++ MVP]
- property inference
- Prev by Date: Best Pattern Practice - Custom Web Control Events.
- Next by Date: Re: Creating a derived object from a based object
- Previous by thread: Re: property inference
- Next by thread: Re: property inference
- Index(es):
Relevant Pages
|