
05/03/2008, 19:11
|
| | Fecha de Ingreso: febrero-2008 Ubicación: Macuspana,Tabasco
Mensajes: 33
Antigüedad: 17 años Puntos: 0 | |
Re: Borrar Un Dato Especifico En Un ArrayList C# using System;
using System.Collections;
using System.Text;
namespace Programa
{
class Alumno : Persona, Comunes //SE HEREDA PERSONA Y LA INTERFACE
{
ArrayList alum = new ArrayList();
int matricula;
string carrera = "";
public Alumno()
{
this.matricula = 0;
this.carrera = "";
}
public void menualum()
{
int retorno = 1;
while (retorno == 1)
{
Console.Clear();
Console.WriteLine("OPCIONES PARA ALUMNOS");
Console.WriteLine("1.-GUARDAR");
Console.WriteLine("2.-ELIMINAR");
Console.WriteLine("3.-CONSULTAR");
Console.WriteLine("ESCOJA UNA DE LAS OPCIONES");
int opci = int.Parse(Console.ReadLine());
if (opci == 1)
{
alta();
}
if (opci == 2)
{
baja();
}
if (opci == 3)
{
consulta();
}
if ((opci < 1) || (opci > 3))
{
Console.WriteLine("opcion incorrecta");
}
Console.WriteLine("desea realizar otra operacion 1 o 0");
retorno = int.Parse(Console.ReadLine());
}
}
public void alta()
{
object[] estudiante = new object[4];
Console.WriteLine("escriba los datos del alumno");
Console.Write("matricula");
estudiante[0] = int.Parse(Console.ReadLine());
Console.Write("nombre");
estudiante[1] = int.Parse(Console.ReadLine());
Console.Write("edad");
estudiante[2] = int.Parse(Console.ReadLine());
Console.Write("carera");
estudiante[3] = int.Parse(Console.ReadLine());
alum.Add(estudiante);
Console.WriteLine("los datos de alumnos han sido guardados");
}
public void baja()
{
Console.WriteLine("dar de baja a un alumno");
}
public void consulta()
{
//Console.WriteLine("consultar todos los datos de los alumnos");
foreach (object j in ArrayList) /// AQUI ES DONDE QUIERO HACER LA CONSULTA
Console.WriteLine(alum.ToString());
}
public override string ToString()
{
return nombre + edad + matricula + carrera;
}
}
} |