컴파일러 오류 CS0668
업데이트: 2007년 11월
오류 메시지
두 인덱서의 이름이 다릅니다. IndexerName 특성은 한 형식 안의 모든 인덱서에 대해서는 같은 이름으로 사용되어야 합니다.
Two indexers have different names; the IndexerName attribute must be used with the same name on every indexer within a type
IndexerName 특성에 전달되는 값은 형식 안에 있는 모든 인덱서에 대해 같아야 합니다. IndexerName 특성에 대한 자세한 내용은 IndexerNameAttribute 클래스를 참조하십시오.
다음 샘플에서는 CS0668 오류가 발생하는 경우를 보여 줍니다.
// CS0668.cs
using System;
using System.Runtime.CompilerServices;
class IndexerClass
{
[IndexerName("IName1")]
public int this [int index] // indexer declaration
{
get
{
return index;
}
set
{
}
}
[IndexerName("IName2")]
public int this [string s] // CS0668, change IName2 to IName1
{
get
{
return int.Parse(s);
}
set
{
}
}
void Main()
{
}
}