public static string GetPageCategory(this SamplePage self) { var attr = self.GetType().GetTypeInfo().GetCustomAttribute(typeof(SamplePageAttribute)) as SamplePageAttribute; if (attr != null) { return(attr.Category); } return(string.Empty); }
public static string GetPageCategory(this SamplePage self) { if (self == null) { throw new ArgumentNullException("self"); } var attr = self.GetType().GetTypeInfo().GetCustomAttribute(typeof(SamplePageAttribute)) as SamplePageAttribute; if (attr != null) { return(attr.Category); } return(string.Empty); }