System.Collections.Tests.Helpers.PerformActionOnAllSortedListWrappers C# (CSharp) Method

PerformActionOnAllSortedListWrappers() public static method

public static PerformActionOnAllSortedListWrappers ( SortedList sortedList, Action action ) : void
sortedList SortedList
action Action
return void
        public static void PerformActionOnAllSortedListWrappers(SortedList sortedList, Action<SortedList> action)
        {
            // Synchronized returns a slightly different version of Stack
            SortedList[] sortedListTypes =
            {
                (SortedList)sortedList.Clone(),
                SortedList.Synchronized(sortedList)
            };

            foreach (SortedList sortedListType in sortedListTypes)
            {
                action(sortedListType);
            }
        }