Skip to content

Instantly share code, notes, and snippets.

@AntMooreWebDev
Last active July 28, 2017 10:10
Show Gist options
  • Select an option

  • Save AntMooreWebDev/53e527ad0f84163a008c6c55591189d4 to your computer and use it in GitHub Desktop.

Select an option

Save AntMooreWebDev/53e527ad0f84163a008c6c55591189d4 to your computer and use it in GitHub Desktop.
public static class CheckDynamicUmbracoProperties<T>
{
public static T SelectFirstPropertyValueOfGivenAlias(IPublishedContent ChildPage, string PropertyTypeAlias)
{
var query = ((Dictionary<string, IPublishedProperty>
.ValueCollection)ChildPage.Properties)
.Where(x => x.PropertyTypeAlias == PropertyTypeAlias)
.Select(x => x.Value).Cast<T>()
.FirstOrDefault();
return query;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment