I have the following method:
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);
}
This is the dictionarry methodTaggings:
private static Dictionary<byte, List<Method>> methodTaggings = new Dictionary<byte, List<Method>>();
Now I always get a NullReferenceException in the line
Console.WriteLine(outList.Count);
But I can’t see why? Even if I don’t find a value in the dictionnary, the list shouldn’t be null?
Should this not be: