Wednesday

Derive Collection class:Override Add,Insert,Remove methods

These methods are not overridable,
will be more correctly to override InsertItem,RemoveItem methods, they will be called from other methods Add,Insert,Remove , etc

using System.Collections.ObjectModel;
using System.Diagnostics;
using System;
namespace CollectionTest
{
class Program
{
static void Main(string[] args)
{
Debug.Write("MAIN");
LimitedCollection<String> col = new LimitedCollection<String>();
col.Add("hello");
col.Insert(0,"hello");

}
}
public class LimitedCollection<T> : Collection<T>
{
protected override void InsertItem(int index, T item)
{
base.InsertItem(index, item);
Debug.Write("InsertItem called");
}
}
}

more...

No comments:

make ubuntu business casual

to make ubuntu business casual - make it black remove background: gsettings set org.gnome.desktop.background picture-options ...