C#: Enable nullability in Semmle.Util

This commit is contained in:
Calum Grant
2020-03-26 20:10:21 +00:00
parent 376779421d
commit 8a968dac81
13 changed files with 31 additions and 32 deletions

View File

@@ -9,10 +9,9 @@ namespace Semmle.Util
/// dictionary. If a list does not already exist, a new list is
/// created.
/// </summary>
public static void AddAnother<T1, T2>(this Dictionary<T1, List<T2>> dict, T1 key, T2 element)
public static void AddAnother<T1, T2>(this Dictionary<T1, List<T2>> dict, T1 key, T2 element) where T1:notnull
{
List<T2> list;
if (!dict.TryGetValue(key, out list))
if (!dict.TryGetValue(key, out var list))
{
list = new List<T2>();
dict[key] = list;