Click or drag to resize

DictExtensions Class

Helper extensions for the generic dictionary container.
Inheritance Hierarchy
SystemObject
  KSPDev.ExtensionsDictExtensions

Namespace:  KSPDev.Extensions
Assembly:  KSPDev_Utils.1.2 (in KSPDev_Utils.1.2.dll) Version: 1.2 for KSP v1.6+
Syntax
C#
public static class DictExtensions
Request Example View Source

The DictExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberCode exampleSetDefaultK, V
Returns a value from the dictionary by a key. If the key is not present yet, then a new default entry is created and returned.
Top
Examples
public static void SetDefaultAddToDict(Dictionary<int, HashSet<string>> dict) {
  // If key 123 doesn't exist it will be created automatically.
  dict.SetDefault(123).Add("abc");
}
See Also