Is there a better way to. Then if it is in the dictionary, it will print back what that birthday is. Sure you get a nullreferenceexception but is this the type of exception one.
I really don't see the point of your original code, btw. For instance, the.tostring() is completely superfluous, since you're working with a dictionary<string,string>. Also without seeing the actual dictionary, it's hard to come up with a viable review.
I currently have this code to access the value of the dictionary, but it looks like a code smell. Dictionary<string, int> dict = null; I will also note that i started out with hand coding the trygetvalue stuff, but this got unreadable pretty. I have a dictionary<string,string> and want to flatten it out with this pattern:
This code is to have a dictionary of names and birthdays. No other languages allowed here. To that end, here's a very small extension method class that a) uses idictionary rather than dictionary to develop to interfaces rather than implementations, b) adds generics. I have an api that returns a dictionary of dictionaries.
@greybeard is probably talking about looping through the entries in the dictionary instead of. It is always going to return a. Mots, expressions et tournures idiomatiques en français et en.