-2

Following NullReferenceException throws when ChildFolders() gets called. In the bottom of the picture, one can see that at least one desired Folder exists. But trying to access them doesnt work. How does this happen?

Following NullReferenceException

Kracker
  • 11
  • 3

1 Answers1

-1

Just use the null-conditional operator

return Folders.FindAll(x => x?.ParentFolderID == parentFolderId);
Innat3
  • 3,561
  • 2
  • 11
  • 29