Esempio n. 1
0
        /// <summary>
        /// Unsubscribes the specified writer from library events.
        /// </summary>
        /// <param name="writer">The writer to unsubscribe.</param>
        public static void Unsubscribe(IAnalysisWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer", "writer cannot be null");
            }
            lock (syncRoot) {
                int containingIndex = -1;
                for (int i = 0; i < totalWriters; i++)
                {
                    if (analysisWriters[i].AnalyticsId.Equals(writer.AnalyticsId, StringComparison.Ordinal))
                    {
                        containingIndex = i;
                        break;
                    }
                }

                if (containingIndex != -1)
                {
                    analysisWriters.Remove(writer);
                    totalWriters--;
                }
            }
        }
        /// <summary>
        /// Unsubscribes the specified writer from library events.
        /// </summary>
        /// <param name="writer">The writer to unsubscribe.</param>
        public static void Unsubscribe(IAnalysisWriter writer)
        {
            if (writer == null)
                throw new ArgumentNullException("writer", "writer cannot be null");
            lock (syncRoot) {
                int containingIndex = -1;
                for (int i = 0; i < totalWriters; i++) {
                    if (analysisWriters[i].AnalyticsId.Equals(writer.AnalyticsId, StringComparison.Ordinal)) {
                        containingIndex = i;
                        break;
                    }
                }

                if (containingIndex != -1) {
                    analysisWriters.Remove(writer);
                    totalWriters--;
                }
            }
        }