인덱서 (프로그래밍)
인덱서(indexer)는 객체 지향 프로그래밍에서 특정 클래스나 구조체의 인스턴스가 배열과 같이 인덱싱될 수 있게 한다.[1] 연산자 오버로딩의 일종이다.
예시
편집인덱서를 클래스에 사용한 C#의 예는 다음과 같다:[2]
class OurFamily
{
private long[] familyMember = new long[7];
public long this [int index]
{
// The get accessor
get
{
return familyMember[index];
}
// The set accessor with
set
{
familyMember[index] = value;
}
}
}
같이 보기
편집각주
편집- ↑ jagadish980 (2008년 1월 29일). “C# - What is an indexer in C#”. http://forums.sureshkumar.net/forum.php: Bulletin: SURESHKUMAR.NET FORUMS. 2009년 9월 22일에 원본 문서에서 보존된 문서. 2011년 8월 1일에 확인함.
- ↑ “C# Interview Questions”. http://www.dotnetfunda.com/: .net Funda. 2011년 8월 1일에 확인함.