I know that most cases of a NullReferenceException are caused of missing initialization. But I initializated MTemp and FTemp.
What I'm missing?
Important code inside the class "Foo":
class Team
{
public List<Fahrer> TeamFahrer { get; set; }
public void Bar(string salad, string hotdog, string brokkoli)
{
Motorrad MTemp = new Motorrad(brokkoli);
Fahrer FTemp = new Fahrer(salad, hotdog, MTemp);
TeamFahrer.Add(FTemp);
}
}
Important code inside Motorrad:
class Motorrad
{
public Motorrad(string marke)
{
Marke = marke;
}
public string Marke { get; set; }
}
Important Code inside Fahrer:
class Fahrer
{
public Fahrer(string salad, string hotdog, Motorrad moped)
{
Vorname = salad;
Nachname = hotdog;
MotorradDesFahrers = moped;
}
public string Vorname { get; set; }
public string Nachname { get; set; }
public Motorrad MotorradDesFahrers { get; set; }
}