Exemplo n.º 1
0
        public static void Test()
        {
            List <int> list = new List <int>()
            {
                1, 2, 3, 4
            };
            ListHKT <int>    listHKT       = new ListHKT <int>(list);
            ListF            listFunctor   = new ListF();
            ListHKT <double> mappedListHKT = (ListHKT <double>)listFunctor.Map(x => x + 1.5, listHKT);
            List <double>    mappedList    = mappedListHKT.value;

            foreach (var ele in mappedList)
            {
                Console.Write(ele + " ");
            }
            // 2.5 3.5 4.5 5.5

            Console.WriteLine();
            List <double> list2 =
                ((ListHKT <double>) new ListF().Map(x => x + 1.5,
                                                    new ListHKT <int>(
                                                        new List <int>()
            {
                1, 2, 3, 4
            }))).value;

            foreach (var ele in list2)
            {
                Console.Write(ele + " ");
            }


            //ListHKT<int> listHKT = new List<int>() { 1, 2, 3, 4 };
            //List<double> mappedList = (ListHKT<double>)new ListF().Map(x => x + 1.5, listHKT);
        }
Exemplo n.º 2
0
        public UsersViewModel()

        {
            this.ListF = new ObservableCollection <FiliereCount>();

            var filCount = from etudiant in cl.etudiants
                           join filiere in cl.filieres
                           on etudiant.id_filiere equals filiere.id_filiere
                           group new { etudiant, filiere } by filiere.nom_filiere
            into grouping
                select new
            {
                grouping.Key,
                nbEtudiant = grouping.Count()
            };

            foreach (var gr in filCount)
            {
                ListF.Add(new FiliereCount {
                    Filiere = gr.Key, nbEtudiant = gr.nbEtudiant
                });
            }
        }