4
Reply

Why fails to build this class?

Isidro Padilla

Isidro Padilla

Aug 26 2011 6:35 AM
1.4k

Hello everyone.

I have the following problem. I created the class attached below, but send me the following error:


Error: 'Tripolis.Compara' does not implement interface member
'System.Collections.Generic.IComparer<string>.Compare(string, string)'
C:\Curso_5\Tripolis\Compara.cs 9 16Tripolis




Although I tried to find a solution in the network I have not managed to find it.

I hope someone on the forum can help me.
Thanks in advance.

ipadillar

oooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooo

using System.Collections.Generic;

namespace Tripolis
{
public class Compara : IComparer<string>
{
public int Method1(string _parametro1, string _parametro2)
{
return parametro1.Length.CompareTo(parametro2.Length);
}
}
}

oooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooo

Translated into spanish:


Hola a todos.
Tengo el siguiente problema. He creado la clase que adjunto más abajo, pero me envía el siguiente error:


Error: 'Tripolis.Compara' does not implement interface member
'System.Collections.Generic.IComparer<string>.Compare(string, string)'
C:\Curso_5\Tripolis\Compara.cs 9 16Tripolis



Aunque he intentado buscar un solución en la red no la he sabido encontrarla.

Espero que alguien en el foro me pueda ayudar.

Gracias por adelantado.
ipadillar

oooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooo

using System.Collections.Generic;

namespace Tripolis
{
public class Compara : IComparer<string>
{
public int Method1(string _parametro1, string _parametro2)
{
return parametro1.Length.CompareTo(parametro2.Length);
}
}
}

oooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooo


Answers (4)