public static void AllocationFreeForEach(IEnumerable <KeyValuePair <TKey, TValue> > instance, ref TState state, StructEnumeratorForEachDelegate <KeyValuePair <TKey, TValue>, TState> itemCallback)
#pragma warning restore CA1000 // Do not declare static members on generic types
        => StructEnumerator <IEnumerable <KeyValuePair <TKey, TValue> >, KeyValuePair <TKey, TValue>, TState> .AllocationFreeForEach(instance, ref state, itemCallback);
예제 #2
0
        /// <summary>
        /// Enumerates over an <see cref="IEnumerable{TItem}" /> instance without allocation if a struct GetEnumerator is available.
        /// </summary>
        /// <param name="instance">The enumerable instance.</param>
        /// <param name="state">State to be passed on each call.</param>
        /// <param name="itemCallback">Delegate to be called as items are retrieved from the enumerator.</param>
#pragma warning disable CA1000 // Do not declare static members on generic types
        public static void AllocationFreeForEach(TEnumerable instance, ref TState state, StructEnumeratorForEachDelegate <TItem, TState> itemCallback)
#pragma warning restore CA1000 // Do not declare static members on generic types
        {
            Debug.Assert(itemCallback != null);

            StructEnumerator <TEnumerable, TItem, TState> .AllocationFreeForEachDelegate allocationFreeForEachDelegate = FindAllocationFreeForEachDelegate(
                instance);

            allocationFreeForEachDelegate(instance, ref state, itemCallback);
        }