Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace lab10
- {
- internal class Program
- {
- public static void Main(string[] args)
- {
- var l = new List<Vedomost>();
- l.Add(new Vedomost("Name1", 4));
- l.Add(new Vedomost("Name2", 3));
- l.Add(new Vedomost("Name3", 5));
- l.Sort(((vedomost, vedomost1) => vedomost.Mark.CompareTo(vedomost1.Mark)));
- foreach (var vedomost in l)
- {
- Console.WriteLine(vedomost.Name);
- }
- }
- }
- public class Vedomost
- {
- public int Mark;
- public string Name;
- public Vedomost(string name, int mark)
- {
- Mark = mark;
- Name = name;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement