Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
linq
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public enum ItemType { Sword, Shield } public class ShopItem { public int Cost { get ; set; } public string Name { get; set; } public ItemType Type { get; set; } } public class Program { public static void Main(string[] args) { ICollection<ShopItem> items = new List<ShopItem>(); items.Add(new ShopItem () { Cost = 5, Name = "A", Type = ItemType.Sword }); items.Add(new ShopItem () { Cost = 6, Name = "B", Type = ItemType.Shield }); items.Add(new ShopItem () { Cost = 6, Name = "C", Type = ItemType.Sword }); items.Add(new ShopItem () { Cost = 7, Name = "D", Type = ItemType.Sword }); items.Add(new ShopItem () { Cost = 3, Name = "E", Type = ItemType.Sword }); items.Add(new ShopItem () { Cost = 8, Name = "F", Type = ItemType.Shield }); var swords = from item in items where item.Type == ItemType.Sword orderby item.Cost descending select item; Console.WriteLine("Most Expensive sword: {0}", swords.First().Name); } } }
run
|
edit
|
history
|
help
0
Sample
SELECT YEAR('2019-08-15 01:02:03')+10
C# - MD5Hash
SunLocation
Simple Constructor Implementation
Fórum regex only alphanumerics (except underscore)
Fibonacci of array elements C#
task 1
monopoly11
BEISPEIL- AUGUST 6 -2019