Created
March 26, 2018 22:56
-
-
Save mawiseman/df23594c570bb27c17d9c4569663e72f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
public static class ItemExtensions | |
{ | |
public static T GetValueAs<T>(this Item contextItem, ID settingFieldID) | |
{ | |
return (T)System.Convert.ChangeType(contextItem.Fields[settingFieldID].Value, typeof(T)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment