1

I use Umbraco v8 and code is here

var home = Model.Root();
var results = home.Children.FirstOrDefault(i => i.IsDocumentType("results"));
var resultSliders = (results?.GetProperty("resultSliders")?.GetValue() as IEnumerable<IPublishedContent>) ?? new List<IPublishedContent>();

error message is

Object reference not set to an instance of an object.

but the results content is not empty and GetProperty("resultSliders").HasValue() return is true so I have no idea why it is giving error results?.GetProperty("resultSliders")?.GetValue(). resultSliders Property is custom nested content data type

4

0 回答 0