
10/03/2008, 18:23
|
 | Colaborador | | Fecha de Ingreso: septiembre-2007 Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 17 años, 5 meses Puntos: 87 | |
Re: Using List.Contains() pues aqui te pongo un sample pequeño
class Alumno
{
public string name;
public string id;
public string school;
}
class Alumnos : ICollection<Alumno>
{
#region ICollection<Alumno> Members
public bool Contains(Alumno item)
{
foreach (Alumno current in this)
{
if (current.Equals(item))
return true;
}
return false;
}
public bool Contains(string id)
{
foreach (Alumno current in this)
{
if (current.id.Equals(id))
return true;
}
return false;
}
#endregion
} |