public static void Main() {
DateTimeList sampleList = new DateTimeList(5);
sampleList.Add(new DateTime(2015, 6, 1));
sampleList.Add(new DateTime(2015, 6, 12));
sampleList.Add(new DateTime(2015, 6, 3));
sampleList.Add(new DateTime(2015, 6, 8));
sampleList.Add(new DateTime(2015, 6, 5));
for (int i = 0; i < sampleList.Count; i++) {
Console.Write(sampleList[i].ToString("d") + " ");
Console.WriteLine("Size: " + sampleList.Count);
Console.WriteLine("Capacity: " + sampleList.Capacity);
int index = sampleList.IndexOf(new DateTime(2015, 6, 3), 0, sampleList.Count);
Console.WriteLine("Индекс искомой даты: " + index);
sampleList.Insert(1, new DateTime(2015, 7, 25));
for (int i = 0; i < sampleList.Count; i++) {
Console.Write(sampleList[i].ToString("d") + " ");
Console.WriteLine("Size: " + sampleList.Count);
Console.WriteLine("Capacity: " + sampleList.Capacity);
DateTime[] newArray = new DateTime[sampleList.Count];
sampleList.CopyTo(newArray);
for (int i = 0; i < newArray.Length; i++) {
Console.Write(newArray[i].ToString("d") + " ");
public class DateTimeList {
get { return this.count; }
get { return this.M.Length; }
if (value > this.M.Length) {
DateTime[] s = new DateTime[value];
Array.Copy(this.M, 0, s, 0, count);
public DateTimeList(int size) {
this.M = new DateTime[size];
public void Add(DateTime item) {
this.M[this.count] = item;
if (count == this.M.Length) {
DateTime[] list = new DateTime[this.M.Length * 2];
for (int i = 0; i < this.count; i++) {
public void Insert(int index, DateTime value) {
if (index < this.count) {
for (int i = this.count; i > index; i--) {
this.M[this.count] = value;
if (count == this.M.Length) {
DateTime[] list = new DateTime[this.M.Length * 2];
for (int i = 0; i < this.count; i++) {
public int IndexOf(DateTime value, int startIndex, int count) {
for (int i = startIndex; i < startIndex + count; i++) {
if (this.M[i] == value) {
public void CopyTo(DateTime[] myTargetArray) {
for (int i = 0; i < this.count; i++) {
myTargetArray[i] = this.M[i];
public DateTime this[int i] {