I am having a problem getting a value from my dictionary object. The TryGetValue Method returns true which indicates that it is finding the key in the dictionary but emps variable is not being populated with the value in the dictionary. What am I doing wrong?

thanks for your help!

private Dictionary<int, List<Employee>> _employees;

protected void Page_Load(object sender, EventArgs e)
    {
        foreach (Schedule s in _departmentSchedules) 
        {
                       _employees.Add(s.ID, s.GetEmployees());
         }

 List<Employee> emps;
            _employees.TryGetValue(15, out emps);
Response.Write(emps.count);
}

nevermind I found the problem. Dumb coding mistake in another part of the app.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.