Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace SortList
- {
- class Program
- {
- struct Weapon
- {
- public int DPS;
- public Weapon(int DPS)
- {
- this.DPS = DPS;
- }
- }
- static List<Weapon> weapons = new List<Weapon>(100);
- static void Main(string[] args)
- {
- var rnd = new Random();
- for (int i = 0; i < 100; i++)
- weapons.Add(new Weapon(rnd.Next(100)));
- //weapons.Sort((w1, w2) => w2.DPS.CompareTo(w1.DPS));
- weapons.Sort((w1, w2) => w2.DPS - w1.DPS);
- weapons.ForEach(x => Console.WriteLine(x.DPS));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement