I have the following code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LINQArrayListTips05
{
class Program
{
static void Main(string[] args)
{
ArrayList lista = new ArrayList();
lista.AddRange(new object[] { "hola", 5, 6.7, false, 4, 2, "saludos", 3.5, 3 });
var enteros = lista.OfType<int>();
foreach (int n in enteros)
Console.WriteLine(n);
Console.WriteLine("---------------");
ArrayList estudiantes = new ArrayList();
{
new CEstudiante("Jhon", "A203", "Telemática", 3.6),
new CEstudiante("Ana", "B304", "Informática", 4.2),
new CEstudiante("Pedro", "C405", "Psicología", 2.6),
new CEstudiante("Erick", "D506", "Escritura", 4.9),
new CEstudiante("Jaime", "E607", "Ingles", 1.6),
new CEstudiante("Juan", "F708", "Humanidades", 3.8)
};
var estL = estudiantes.OfType<CEstudiante>();
var reprobados = from e in estL
where e.Promedio <= 3.0
select e;
Console.WriteLine("Reprobados");
foreach (CEstudiante r in reprobados)
Console.WriteLine(r);
Console.WriteLine("Presione un tecla para continuar");
Console.ReadKey();
}
}
}
But when I run it, I get the following error:
Severity Code Description Project File Line Status suppressed Error CS1002 Expected;
By setting the ;
where the compiler asks for it, the program does not work as it should. Does anyone know why this happens?