Self Closures Consol

Self close consol application
Program.cs
static void Main(string[] args)
        {
            List lstofclass = new List
            {
                new MyClass { Name = "Darshan", Credit=3000},
                new MyClass { Name= "Hardik", Credit= 2000},
                new MyClass { Name = "Bhaumik", Credit=6000},
                new MyClass { Name= "Rachit", Credit=9000}
            };
            var items = lstofclass.Where(item => item.Credit > 3000);
            Program.ForEach(items, x => Console.WriteLine("Name : {0}", x.Name));
            Console.ReadLine();
        }

        public static void ForEach(IEnumerable source, Action myaction)
        {
            foreach (var x in source)
                myaction(x);
        }
MyClass.cs
class MyClass
    {
        public string Name { get; set; }
        public int Credit { get; set; }
    }
Self Closures Consol Self Closures Consol Reviewed by Bhaumik Patel on 11:52 PM Rating: 5