Пример #1
0
        /***************************************************/

        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);
            }
        }
Пример #2
0
        /***************************************************/
        /**** 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);
            }
        }