ho un oggetto che rappresenta una tabella di un db con varie propietà.
dovrei implementare un Compare personalizzato.
ho iniziato ma poi mi sono fermato perchè ho qualche dubbio:
codice:
using System;
using System.Collections.Generic;
namespace Banca
{
public class Entrate: IComparer<Entrate>
{
public int id { get; set; }
public decimal valore { get; set; }
public int causale_id { get; set; }
public int conto_id { get; set; }
public string data { get; set; }
public string note { get; set; }
public int tb_causale_id { get; set; }
public string causale_nome { get; set; }
public int tb_conto_id { get; set; }
public string conto_nome { get; set; }
public Entrate(int id, decimal valore, int causale_id, int conto_id, string data, string note, int tb_causale_id, string causale_nome, int tb_conto_id, string conto_nome)
{
this.id = id;
this.valore = valore;
this.causale_id = causale_id;
this.conto_id = conto_id;
this.data = data;
this.note = note;
this.tb_causale_id = tb_causale_id;
this.causale_nome = causale_nome;
this.tb_conto_id = tb_conto_id;
this.conto_nome = conto_nome;
}
public int compare(Entrate x, Entrate y)
{
if (x == null) throw new ArgumentException("x");
if (y == null) throw new ArgumentException("y");
int result;
return result;
}
}
}
come faccio a compararne uno per uno??