Last active
April 21, 2018 06:07
-
-
Save albilaga/a6a26a721ee074c4dd9a9a81f326cd5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
// you can also use other imports, for example: | |
// using System.Collections.Generic; | |
// you can write to stdout for debugging purposes, e.g. | |
// Console.WriteLine("this is a debug message"); | |
public class Test | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
} | |
class Solution | |
{ | |
static void Main() | |
{ | |
List<Test> tests = new List<Test> | |
{ | |
new Test | |
{ | |
Id=2, | |
Name="A" | |
}, | |
new Test | |
{ | |
Id=1, | |
Name="B" | |
}, | |
new Test | |
{ | |
Id=3, | |
Name="C" | |
} | |
}; | |
var ordered = tests.OrderBy(x => x.Id); | |
foreach (var order in ordered) | |
{ | |
Console.WriteLine($"order {order.Id} with name {order.Name}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment