Replies: 4 comments 1 reply
-
Use the following wrapper:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
This is a request for dotnet/runtime |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think @amshaikh provided the solution (though for efficiency the caller should use |
Beta Was this translation helpful? Give feedback.
0 replies
-
This functionality is provided through the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions