GSF.Diagnostics.PerformanceMonitor.FindCounter C# (CSharp) Method

FindCounter() public method

Returns a PerformanceCounter object matching the specified counter name.
First PerformanceCounter with matching name is returned. If same name exists within multiple monitored categories, use FindCounter(string,string) overload instead.
public FindCounter ( string counterName ) : PerformanceCounter
counterName string Name of the to be retrieved.
return PerformanceCounter
        public PerformanceCounter FindCounter(string counterName)
        {
            lock (m_counters)
            {
                foreach (PerformanceCounter counter in m_counters)
                {
                    if (string.Compare(counter.BaseCounter.CounterName, counterName, StringComparison.OrdinalIgnoreCase) == 0)
                        return counter; // Return the match.
                }
            }

            return null;    // No match found.
        }

Same methods

PerformanceMonitor::FindCounter ( string categoryName, string counterName ) : PerformanceCounter