protected virtual void onTableResized(TableResizedEventArgs e) { if (TableResized != null) { TableResized(this, e); } }
public void Resize(int targetSize) //Zrobic resize do index * 2, zamiast resize'owac wielokrotnie np dla 1000 indexu { if (targetSize >= allocatedSize) { int newAllocatedSize = targetSize * arrayExpandFactor; TableResizedEventArgs eventArgs = new TableResizedEventArgs(allocatedSize, newAllocatedSize); int[] newTable = new int[newAllocatedSize]; table.CopyTo(newTable, 0); table = newTable; allocatedSize = newAllocatedSize; onTableResized(eventArgs); for (int i = size; i < allocatedSize; i++) { table[i] = defaultValue; } } }
static void TableResized(object source, TableResizedEventArgs e) { Console.WriteLine(e.Description); }