private static object GetMetadata(CHXContentType ct) { var type = ct.GetType(); MemberInfo[] info = type.GetMember(ct.ToString()); if ((info != null) && (info.Length > 0)) { object[] attrs = info[0].GetCustomAttributes(typeof(CHXMetadata), false); if ((attrs != null) && (attrs.Length > 0)) { return(attrs[0]); } } return(null); }
public static string ToValue(this CHXContentType ct) { var metadata = GetMetadata(ct); return((metadata != null) ? ((CHXMetadata)metadata).Value : ct.ToString()); }