Пример #1
0
 /// <summary>
 /// Returns value of the Nested Content property from the source.
 /// If property (Nested conten returns null if nothing is created) is null, returns empty enumeration.
 /// </summary>
 /// <typeparam name="TNestedContent">Type of the NestedContent model.</typeparam>
 /// <param name="source">The source.</param>
 /// <param name="propertyName">Name of the property.</param>
 /// <returns>Value of the NestedContent property. </returns>
 public static IEnumerable <TNestedContent> GetNestedContentPropertyValue <TNestedContent>(
     this IPublishedElement source, [CallerMemberName] string propertyName = null)
     where TNestedContent : INestedContent
 => source.GetPropertyValue <IEnumerable <IPublishedElement> >(propertyName.ToFirstLower()).EmptyIfNull().OfType <TNestedContent>();