Help with Dictionary c#

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 7
Reputation: mcdt2424 is an unknown quantity at this point 
Solved Threads: 0
mcdt2424 mcdt2424 is offline Offline
Newbie Poster

Help with Dictionary c#

 
0
  #1
Apr 24th, 2009
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!

  1. private Dictionary<int, List<Employee>> _employees;
  2.  
  3. protected void Page_Load(object sender, EventArgs e)
  4. {
  5. foreach (Schedule s in _departmentSchedules)
  6. {
  7. _employees.Add(s.ID, s.GetEmployees());
  8. }
  9.  
  10. List<Employee> emps;
  11. _employees.TryGetValue(15, out emps);
  12. Response.Write(emps.count);
  13. }
Last edited by peter_budo; Apr 25th, 2009 at 5:31 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 7
Reputation: mcdt2424 is an unknown quantity at this point 
Solved Threads: 0
mcdt2424 mcdt2424 is offline Offline
Newbie Poster

Re: Help with Dictionary c#

 
0
  #2
Apr 24th, 2009
nevermind I found the problem. Dumb coding mistake in another part of the app.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC