2008년 05월 21일
[LINQ] Auto-Implemented Properties
Property 구현에 있어서 기존에 구현해야 했던 내용을 간략하게 구현할 수 있는 기능입니다.
class Person
{
string name;
int age;
public string Name
{
get { return name; }
set { name = value; }
}
public string Age
{
get { return age; }
set { age = value; }
}
} class Person { public int Age { get; set; } } 만일 Read Only Property 구현 시 private accessor를 사용하면 됩니다. public int ID { get; private set; }
는 다음과 같이 간략히 구현할 수 있습니다.
public string Name { get; set; }
# by | 2008/05/21 16:39 | 트랙백 | 덧글(0)




☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]