У меня есть следующий метод:
internal static void removeMethodFromTag(byte p, Method method)
{
Console.WriteLine("Remove method " + method.getName() + " from the tag");
List<Method> outList = new List<Method>();
methodTaggings.TryGetValue(p, out outList);
Console.WriteLine(outList.Count);
outList.Remove(method);
methodTaggings.Remove(p);
methodTaggings.Add(p, outList);
}
Это метод словаря Теги:
private static Dictionary<byte, List<Method>> methodTaggings = new Dictionary<byte, List<Method>>();
Теперь я всегда получаю NullReferenceException
в строке
Console.WriteLine(outList.Count);
Но я не понимаю, почему?Даже если я не найду значение в словаре, список не должен быть нулевым?