Inserting 3 fields into dictionary and how to retrieve them
<p>I am trying to insert three fields into dictionary, so converted two fields into object type and added to the dictionary</p>

<pre><code>int empId;
String empName;
decimal salary;

public EmployeeClass(string empName,decimal salary)
{
    this.empName = empName;
    this.salary = salary;
}

//creating dictionary object
Dictionary&lt;int, object&gt; employeeDictionary = new Dictionary&lt;int, object&gt;();

EmployeeClass emp;

for(int i=0;i&lt;5;i++)
{
    Console.WriteLine("Enter Employee " + (i+1) + " details ");
    Console.WriteLine("Enter Employee ID ");
    empId = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("Enter Employee Name ");
    empName = Console.ReadLine();

    Console.WriteLine("Enter Salary of the employee ");
    salary= Convert.ToDecimal(Console.ReadLine());

    //creating object for two fields
    emp= new  EmployeeClass(empName,salary);

    //adding to dictionary one is field and other object
    employeeDictionary.Add(empId, emp);
}
</code></pre>

<p>Now I am trying to retrieve the details from the dictionary:</p>

<pre><code>var list = employeeDictionary.Keys.ToList();
list.Sort();

Console.WriteLine("The Employee details according to EmpID is ");

foreach(var temp in list) 
{
    Console.WriteLine(temp + " " + employeeDictionary[temp].empName + " " + employeeDictionary[temp].salary);
}
</code></pre>

<p>but I am getting this error:</p>

<blockquote>
  <p>Object does not contain definition for empName and no extension method empName accepting a first argument of type Object </p>
</blockquote>

<p>How to retrieve the details from dictionary when an object type is given?</p>