Why does Entity Framework return null List<> instead of empty ones?
I'm pretty new in the ASP .NET MVC world. Maybe, that's the reason I can't explain to myself the cause of what is, for me, an annoying problem. I have one class with One-To-Many relashionship. class MyClass{ public List<OtherClass> otherClasses {get;set;} } When I'm persisting one instance of this class, I fill it's relationship with an empty List<> MyClass myClass = new MyClass(){ otherClasses = new List<OtherClass>() } context.myClass.Add(myClass); The problem is that, when I try to retrieve that instance, and for any reason, I try to access that list, system gives me a Null Reference