Change Name to MultiTool

This commit is contained in:
Jonathan Jenne
2021-10-29 10:37:04 +02:00
parent f00e332737
commit 1035a0fb1f
121 changed files with 186 additions and 185 deletions

View File

@@ -0,0 +1,17 @@
Imports System.Runtime.CompilerServices
Module IDictionaryEx
<Extension()>
Function GetOrDefault(Of TKey, TValue)(pDictionary As Dictionary(Of TKey, TValue), pKey As TKey, Optional pOnMissing As TValue = Nothing) As TValue
Dim oValue As TValue
Return IIf(pDictionary.TryGetValue(pKey, oValue), oValue, pOnMissing)
End Function
<Extension()>
Function GetOrInsertNew(Of T, U As New)(dic As Dictionary(Of T, U), key As T) As U
If dic.ContainsKey(key) Then Return dic(key)
Dim newObj As U = New U()
dic(key) = newObj
Return newObj
End Function
End Module