When its null? ContentArea vs Block

Posted on Updated on

I had mistunderstanding with myself, and I want now to clarify.

Block can never be null according to Joel (link missing).

public virtual MyBlock MyBlock { get; set;}

ContentArea can be null and very often is. (whatever is empty collection or similar, is stored in DB as null)

public virtual ContentAre Pages { get; set;}

FilteredContents gets enumerable from ContentArea items

Posted on Updated on

FilteredContents will do the job.

@foreach (var tag in Model.CurrentPage.AreasOfUse.FilteredContents.OfType<AreaOfUseBlock>())