Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Linq;
- namespace Event
- {
- public class Student
- {
- public string Album { get; set; }
- public string Name { get; set; }
- public double[] Scores { get; set; }
- public override string ToString()
- {
- return "Student: " + Name + " album: " + Album + " oceny: " + string.Join(",", Scores);
- }
- }
- class MainClass
- {
- public static void Main(string[] args)
- {
- ArrayList arrList = new ArrayList();
- arrList.Add(
- new Student
- {
- Album = "1",
- Name = "Malinowski",
- Scores = new double[] { 1.0, 2.5, 2.0, 1.5 }
- });
- arrList.Add(
- new Student
- {
- Album = "2",
- Name = "Nowak",
- Scores = new double[] { 3.0, 3.5 }
- });
- arrList.Add(
- new Student
- {
- Album = "3",
- Name = "Adamiak",
- Scores = new double[] { 4.0, 5.5 , 6.0}
- });
- var query = from Student student in arrList
- where student.Scores.ToList().Average() > 3.0
- select student;
- foreach (Student s in query)
- Console.WriteLine(s.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement