does not implement interface member System Icomparable
I have this code:
using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine.UI; using System;
public class Hablar_con_Inteligencia_4 : MonoBehaviour { bool choque; bool sabio_Pregunta = true; public AudioClip[] cancion ; AudioSource audio;
public InputField usuario_dice;
int sabio_dice;
int x;
int cc = 0;
Charla [] hablando = new Charla[64];
List <QueEncontre> qe;
public class Charla : MonoBehaviour
{
public string tg;
public int sabio_responde;
public Charla (string jugador_dijo, int sabio_respondera) // constructor
{
tg = jugador_dijo;
sabio_responde = sabio_respondera;
}
}// end class Charla
public class QueEncontre : IComparable <QueEncontre>
{
public int registro;
public int coincidencias;
public QueEncontre( int pos, int c)
{
registro = pos;
coincidencias = c;
}
............
Have erre CS0535 does not implement interface member System Icomparable.
I Not found documentation about this. Thanks
Answer by Toon_Werawat · Apr 03, 2016 at 01:46 PM
IComparable is a compare interface. If you put this interface you need to implement it. As I can see your script. At 'QueEncontre' class you need to add this function
public int CompareTo(QueEncontre other)
{
return registro.CompareTo(other.registro);
}
This will compare "registro" variable.
PS: You can change "registro" to anything else on that class. If you don't want to compare "registro"