using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
class ActionCollection : Collection
{
private Action action;
public ActionCollection(Action action)
{
this.action = action;
}
protected override void InsertItem(int index, T item)
{
action(item);
base.InsertItem(index, item);
}
}
public class MainClass
{
public static void Main()
{
ActionCollection ac = new ActionCollection(Console.WriteLine);
ac.Add("console");
}
}
console