public void AddFile(File file) { if (file == null) { throw new ArgumentNullException("File can not be null!"); } if (this.files.Length == this.fileIndex) { ResizeFileContainer(); } this.files[fileIndex] = file; this.fileIndex++; }
private void ResizeFileContainer() { var doubleSize = this.files.Length * 2; var doubleSizedFileContainer = new File[doubleSize]; for (int i = 0, len = this.files.Length; i < len; i++) { doubleSizedFileContainer[i] = this.files[i]; } this.files = doubleSizedFileContainer; }