Properties
- From: "Jon Slaughter" <Jon_Slaughter@xxxxxxxxxxx>
- Date: Sun, 8 Oct 2006 17:32:31 -0500
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
In the above, why doesn't C# just allow one to create a single directive to
make a property?
why not something like
public string Name
{
get { return name; }
set { name = value; }
}
Why the need to declare the same thing basically twice? If, say there was no
block associated with the variable then its assumed to be a field instead of
a property.
i.e.
public string Name; works and is a "Field".
while
public string Name
{
get { return name; }
set { name = value; }
}
is a property.
Thanks,
Jon
.
- Follow-Ups:
- Re: Properties
- From: chanmm
- Re: Properties
- From: Cor Ligthert [MVP]
- Re: Properties
- From: Jon Slaughter
- Re: Properties
- From: Arne Vajhøj
- Re: Properties
- From: Joanna Carter [TeamB]
- Re: Properties
- From: Jon Slaughter
- Re: Properties
- From: Jon Slaughter
- Re: Properties
- Prev by Date: Re: Web Service Question
- Next by Date: Re: Properties
- Previous by thread: hyphen in regular expression (cSharp)
- Next by thread: Re: Properties
- Index(es):
Relevant Pages
|
Loading