public static void Print <T> (this IKolejka <T> kolejka, Action <T> wydruk)
 {
     foreach (var item in kolejka)
     {
         wydruk(item);
     }
 }
 public static void Drukuj <T>(this IKolejka <T> kolejka, Action <T> drukuj)
 {
     foreach (var item in kolejka)
     {
         drukuj(item);
     }
 }
 public static void Drukuj <T> (this IKolejka <T> kolejka, Drukarka <T> wydruk)
 {
     foreach (var item in kolejka)
     {
         wydruk(item);
     }
 }
 public static void Drukuj <T>(this IKolejka <T> kolejka, Drukarka <T> Wypisz)
 {
     foreach (var item in kolejka)
     {
         Wypisz(item);
     }
 }
 public static IEnumerable <Twyj> Mapuj <T, Twyj>(this IKolejka <T> kolejka, Converter <T, Twyj> konwerter)
 {
     foreach (var item in kolejka)
     {
         var wynik = konwerter(item);
         yield return(wynik);
     }
 }
        public static IEnumerable <TWyjscie> ElementJako <T, TWyjscie>(this IKolejka <T> kolejka)
        {
            var konverter = TypeDescriptor.GetConverter(typeof(T));

            foreach (var item in kolejka)
            {
                var wynik = konverter.ConvertTo(item, typeof(TWyjscie));
                yield return((TWyjscie)wynik);
            }
        }
        private static void PrzetwarzanieDanych(IKolejka <double> kolejka)
        {
            var suma = 0.0;

            Console.WriteLine("W naszej kolejce jest: ");
            while (!kolejka.JestPusty)
            {
                suma += kolejka.Czytaj();
            }
            Console.WriteLine(suma);
        }
        private static void PrzetwarzanieDanych(IKolejka <double> kolejka)
        {
            var suma = 0.0;

            Console.WriteLine("Suma elementów bufora");
            while (!kolejka.JestPusty)
            {
                suma += kolejka.Czytaj();
            }
            Console.WriteLine("\tsuma: " + suma);
        }
Exemple #9
0
 private static void WprowadzanieDanych(IKolejka <double> kolejka)
 {
     while (true)
     {
         var wartosc          = 0.0;
         var wartoscwejsciowa = Console.ReadLine();
         if (double.TryParse(wartoscwejsciowa, out wartosc))
         {
             kolejka.Zapisz(wartosc);
             continue;
         }
         break;
     }
 }
 public static IEnumerable <Twyjscie> Mapuj <T, Twyjscie>(this IKolejka <T> kolejka, Converter <T, Twyjscie> konwerter)
 {
     return(kolejka.Select(i => konwerter(i)));
 }
Exemple #11
0
        // private readonly ITest _test;

        public ChatHub(IMapper mapper, IKolejka kolejka)
        {
            _mapper  = mapper;
            _kolejka = kolejka;
        }