public Instrumento Buscar(int posicion, double precioDesde, double precioHasta) { Instrumento obj = new Instrumento(); if ((Lista[posicion]._precio >= precioDesde) && (Lista[posicion]._precio <= precioHasta)) { obj = Lista[posicion]; } return(obj); }
public Instrumento Buscar(int cod) { Instrumento actual = new Instrumento(); foreach (Instrumento inst in Lista) { if (inst._codigo == cod) { actual = inst; } } return(actual); }
//Equals public override bool Equals(Object obj) { if (obj == null) { return(this == null); } else if (this.GetType() != obj.GetType()) { return(false); } else { Instrumento I = (Instrumento)obj; return(_codigo == I._codigo); } }
//Buscar con sobrecarga public Instrumento Buscar(string tipo) { Instrumento actual = new Instrumento(); foreach (Instrumento inst in Lista) { if (inst._tipo == tipo) { actual = inst; } else { actual = new Instrumento(); } } return(actual); }
public void Eliminar(Instrumento obj) { Lista.Remove(obj); }
//Métodos public void Agregar(Instrumento obj) { Lista.Add(obj); }