/***************************************************/ public static bool IsReleased(this Type type) { if (type == null) { return(false); } ReleasedAttribute attribute = type.GetCustomAttribute <ReleasedAttribute>(); if (attribute != null) { try { Version version = new Version(attribute.FromVersion); return(version.CompareTo(type.Assembly.GetName().Version) > 0); } catch { return(true); } } else { return(false); } }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static bool IsReleased(this MethodBase method) { if (method == null) { return(false); } ReleasedAttribute attribute = method.GetCustomAttribute <ReleasedAttribute>(); if (attribute != null) { try { Version version = new Version(attribute.FromVersion); return(version.CompareTo(method.DeclaringType.Assembly.GetName().Version) <= 0); } catch { return(true); } } else { return(false); } }