I am trying to write a method called reallocate, which takes an array called theDirectory, and copies it's contents over into a new array named newDirectory, which has twice the capacity. Then theDirectory is set to newDirectory.
This is what I have so far, however I am stuck on how to copy content across to newDirectory, so any help would be much appreciated.
private void reallocate()
{
capacity = capacity * 2;
DirectoryEntry[] newDirectory = new DirectoryEntry[capacity];
//copy contents of theDirectory to newDirectory
theDirectory = newDirectory;
}
Thanks in advance.