0

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);
}
1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by mcdt2424
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.