Anu
New member
- Joined
- Jan 5, 2022
- Messages
- 1
- Programming Experience
- Beginner
I need to fetch the details of the students who score more the 4 marks using IEnumerable interface in C#
C#:
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public class Student {
public string Name { get;set; }
public decimal Avg { get; set; }
}
static public void Main()
{
var students = new [] {
new Student {
Name = "Andrzej",
Avg = 5
},
new Student {
Name = "Michał",
Avg = 3.4m
},
new Student {
Name = "Heniu",
Avg = 2.4m
},
new Student {
Name = "Bartek",
Avg = 4.5m
}
};
// TODO: get a list of students names with avg above 4 points
IEnumerable<string> above4 = null;
above4.Dump();
}
}
Last edited by a moderator: