Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication11
- {
- class Person
- {
- int age;
- DateTime data;
- string name;
- public Person(string _name, int _age, System.DateTime _data)
- {
- name = _name;
- age = _age;
- data = _data;
- }
- public override string ToString()
- {
- return string.Format("{0} {1} {2}", name, age, data);
- }
- }
- interface Ind
- {
- void Remove(int k);
- int Count {get; set;}
- Person this[int ind] { get; set; }
- }
- class MyClass:Ind
- {
- Person[] M;
- int count;
- int Ind.Count
- {
- get
- {
- return count;
- }
- set
- {
- value = count;
- }
- }
- Person Ind.this[int ind]
- {
- get
- {
- return M[ind];
- }
- set
- {
- value = M[ind];
- }
- }
- public MyClass(ConsoleApplication11.Person[] ar)
- {
- M = new Person[ar.Length];
- Array.Copy(ar, M, ar.Length);
- count = ar.Length;
- }
- public System.Collections.IEnumerator GetEnumerator()
- {
- for (int i = 0; i < count; i++)
- yield return M[i];
- }
- void Ind.Remove(int k)
- {
- count--;
- for (int i = k; i < count; i++)
- M[i] = M[i + 1];
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement