Executes a function on each ICollection item in a but does not accumulate the result. - CSharp System.Collections

CSharp examples for System.Collections:ICollection

Description

Executes a function on each ICollection item in a but does not accumulate the result.

Demo Code


using System.Text;
using System.Collections.Generic;
using System.Collections;
using System;/*  w ww . j  av  a2s.c o m*/

public class Main{
        /// <summary>
        /// Executes a function on each item in a <see cref="ICollection" /> 
        /// but does not accumulate the result.
        /// </summary>
        /// <param name="coll"></param>
        /// <param name="func"></param>
        public static void Apply(ICollection coll, FunctionDelegate<object> func)
        {
            foreach(object obj in coll)
                func(obj);
        }
}

Related Tutorials