using System;
using System.Collections.Generic;
using System.Text;

namespace Array_exemple1
{
    class Program
    {
        static void Main(string[] args)
        {
            /******************* Array demo ***************************/
            byte[] tab = new byte[10];
            Random rnd1= new Random();
            rnd1.NextBytes(tab);
            foreach (byte ibyte in tab) Console.Write(ibyte + " ");
            if (((IList<byte>)tab).Contains(10))   Console.WriteLine("contient la valeur 10");
            else                                   Console.WriteLine("ne contient la valeur 10");
            Array.Sort(tab);
            foreach (byte ibyte in tab) Console.Write(ibyte + " ");
            Console.WriteLine(" \n nombre pair");
            byte[] tab_pair = Array.FindAll(tab, Fct_Recherche_Pair);
            foreach (byte ibyte in tab_pair) Console.Write(ibyte + " ");
            Console.WriteLine("\n redimensionne tableau");
            Array.Resize<byte>(ref tab, 20);
            foreach (byte ibyte in tab) Console.Write(ibyte + " ");
            
          Console.ReadKey();   
        }

        private static bool Fct_Recherche_Pair(byte val)
        {
            if ((val % 2) == 0) 
                return (true);
            else
                return (false);
        }
    }

}
