Exemple #1
0
        /// <summary>
        ///     Returns true if the category is registered in the machine.
        /// </summary>
        public static bool Exists(string categoryName)
        {
            if (categoryName == null)
            {
                throw new ArgumentNullException(nameof(categoryName));
            }

            if (categoryName.Length == 0)
            {
                throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(categoryName), categoryName), nameof(categoryName));
            }

            if (PerformanceCounterLib.IsCustomCategory(categoryName))
            {
                return(true);
            }

            return(PerformanceCounterLib.CategoryExists(categoryName));
        }