Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main ( string [] args )
- {
- Tenant [] arr = new Tenant [5] ;
- arr [1] = new Tenant("pacan",10);
- Predicate<Tenant> tenant = FindTenant;
- Console.WriteLine (Array.FindLastIndex(arr,tenant));
- }
- public static bool FindTenant ( Tenant ten )
- {
- return ten != null;
- }
- }
- class House
- {
- ConsoleColor HouseColor;
- string Adress;
- int MaxTenants;
- private Tenant [] Tenants;
- public bool IsFull = false;
- public House ( ConsoleColor col, string adr, int max )
- {
- HouseColor = col;
- Adress = adr;
- MaxTenants = max;
- Tenants = new Tenant [max];
- }
- public void ShowAdress ( )
- {
- ConsoleColor defaultColor = Console.ForegroundColor;
- Console.ForegroundColor = HouseColor;
- Console.WriteLine (Adress);
- Console.ForegroundColor = defaultColor;
- }
- public void FillHouse ( params Tenant [] tenant)
- {
- //if ( Tenants.GetUpperBound (0) != Tenants.Length - 1 )
- //{
- // int tensCount = Tenants.GetUpperBound ( 0 );
- // while ( !IsFull )
- // {
- // Tenants [tensCount] = tenant [tensCount];
- // if ( tensCount == tens.Length - 1 )
- // {
- // IsFull = true;
- // Console.WriteLine ( "Этот дом уже заполнен" );
- // }
- // }
- //}
- }
- }
- class Tenant
- {
- string Name;
- byte Age;
- public Tenant (string name, byte age)
- {
- Name = name;
- Age = age;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement