コード例 #1
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static bool IsDeprecated(this MethodBase method)
        {
            if (method == null)
            {
                return(false);
            }

            // Keep this one line for now but should be removed once the DepreacatedAttribute is deleted
            DeprecatedAttribute attribute = method.GetCustomAttribute <DeprecatedAttribute>();

            ToBeRemovedAttribute deletedAttribute  = method.GetCustomAttribute <ToBeRemovedAttribute>();
            ReplacedAttribute    replacedAttribute = method.GetCustomAttribute <ReplacedAttribute>();

            if (attribute != null || deletedAttribute != null || replacedAttribute != null)
            {
                return(true);
            }

            if (method is ConstructorInfo)
            {
                return(method.DeclaringType.IsDeprecated());
            }

            return(false);
        }
コード例 #2
0
        /***************************************************/

        public static bool IsDeprecated(this Type type)
        {
            // Keep this one line for now but should be removed once the DepreacatedAttribute is deleted
            DeprecatedAttribute attribute = type.GetCustomAttribute <DeprecatedAttribute>();

            ToBeRemovedAttribute deletedAttribute  = type.GetCustomAttribute <ToBeRemovedAttribute>();
            ReplacedAttribute    replacedAttribute = type.GetCustomAttribute <ReplacedAttribute>();

            if (attribute != null || deletedAttribute != null || replacedAttribute != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }