Dictionary
AddRangeOverride
Adds new values to source dictionary, overriding values for existing keys.
var dictionary = new Dictionary<int, string>
{
{ 1, "One" },
{ 2, "Two" },
{ 3, "Three" },
{ 4, "Four" }
};
var newDictionary = new Dictionary<int, string>
{
{ 1, "One_overridden" },
{ 3, "Three_overridden" },
{ 5, "Five_new" }
};
dictionary.AddRangeOverride(newDictionary);
// results in:
// { 1, "One_overridden" },
// { 2, "Two" },
// { 3, "Three_overridden" },
// { 4, "Four" },
// { 5, "Five_new" }AddRangeNewOnly
Adds new values to source dictionary, leaving existing keys values untouched.
AddRange
Adds new values to source dictionary. Throws if one or more keys in new list already exist in source dictionary.
ContainsKeys
Checks if at least one key from provided list exists in source dictionary.
Last updated
Was this helpful?