Repository navigation
Replies: 4 comments 1 reply
|
Use the following wrapper: |
0 replies
|
This is a request for dotnet/runtime |
0 replies
|
I think @amshaikh provided the solution (though for efficiency the caller should use |
0 replies
|
This functionality is provided through the |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
It would really be handy if the user of the Dictionary<> class be able to set a default value which should be returned if the key is not found in the dictionary.
eg: (Wished code)
Dictionary<string, int> TotalMarks = new Dictionary<string, int>();
TotalMarks.DefaultValue = 0;
Console.WriteLine(TotalMarks["Tom"]); //should work --no need to check whether the key exists or not.
All reactions