Your problem is here:
public static void Main()
{
Employee e = new Employee();
for (int i = 0; i<2; i++)
{
Console.WriteLine("Enter Employee ID", e.EmployeeID);
Console.ReadLine();
Console.WriteLine("Enter Employee name", e.EmployeeName);
Console.ReadLine();
string line = Console.ReadLine();
if (line == "exit")
{
break;
}
}
Console.WriteLine("Employee ID :" + e.EMPID + '\t' + "Employee Name :" + e.Empname);
Console.ReadLine();
}
You only ever create one instance of an Employee - so inside your loop all you could do (if your code did anything, and it won't even compile at the moment, much less do anything useful) - is overwrite the content you already have.
It won't compile because your EMployee class includes code that isn't inside a method:
class Employee
{
public string Empname = "";
public int EMPID = 0;
public int EmployeeID
{
get;
set;
}
public string EmployeeName
{
get;
set;
}
Console.WriteLine(Employee); <<<---- This line isn't in a method
}
But you really need to go back to basics and start again...
class Employee
{
public int EmployeeID { get; set; }
public string EmployeeName { get; set; }
}
Will do for your Employee class.
Now, to use it:
public static void Main()
{
List<Employee> employees = new List<Employee>();
for (int i = 0; i<2; i++)
{
Employee employee = new Employee();
Console.WriteLine("Enter Employee name", e.EmployeeName);
string line = Console.ReadLine();
if (line == "exit")
{
break;
}
... Fill in Employee details here
employees.Add(employee);
}
foreach (Employee employee in employees)
{
... print Employee details here
}
Console.ReadLine();
}