Cześć,
mam taką klasę:
public class TemporaryOutterParameter
{
public string ParameterName { get; set; }
public List<string> AllowedValues { get; set; }
public TemporaryOutterParameter(string parameterName)
{
ParameterName = parameterName;
List<string> AllowedValues = new List<string>();
}
}
i w innym miejscu chciałbym dodać wartość do AllowedValues:
currentTemporaryOutterParameter.AllowedValues.Add(currentEnumTSString.myEnumTSString);
Przy wyjściu z konstruktora widzę, że nie jest to pusta lista (nie jest null, choć ma zero wartości):
AllowedValues = Count = 0
Natomiast w miejscu, gdzie chciałbym dodać wartość do AllowedValues, wartość ta jest nullem:
currentTemporaryOutterParameter.AllowedValues = null
Co może być tego przyczyną?
Otrzymuję wyjątek, potwierdzający powyższe spostrzeżenia:
Object reference not set to an instance of an object.
Pozdrawiam!