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. }