Answers for "c# how to edit a dictionary value"

C#
0

increase value in dictionary against a key in c#

public static void Increment<T>(this Dictionary<T, int> dictionary, T key)
    {
        int count;
        dictionary.TryGetValue(key, out count);
        dictionary[key] = count + 1;
    }
Posted by: Guest on February-25-2021
0

how to change all values in dictionary c#

dict = dict.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Select(v => v.Nr));
Posted by: Guest on August-23-2020

Code answers related to "c# how to edit a dictionary value"

C# Answers by Framework

Browse Popular Code Answers by Language