Error del compilador CS0668
Dos indexadores tienen nombres distintos; el atributo IndexerName se debe utilizar con el mismo nombre en todos los indexadores de un tipo
Los valores pasados al atributo IndexerName deben ser iguales para todos los indexadores de un tipo. Para más información sobre el atributo IndexerName , vea IndexerNameAttribute Class(Clase IndexerNameAttribute).
El ejemplo siguiente genera la advertencia 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()
{
}
}
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: