I have inherited a custom class from List<T>
But after sorting my variable becomes NULL
public class Test
{
public int No { get; set; }
}
public class TestList : List<Test>
{
}
class Program
{
static void Main(string[] args)
{
TestList tests = new TestList() {
new Test(){ No = 101 },
new Test(){ No = 201 },
new Test(){ No = 300 },
new Test(){ No = 401 },
new Test(){ No = 500 },
new Test(){ No = 601 }
};
tests = tests.OrderBy(o => o.No).ToList() as TestList;
}
}
Could anybody please let me know why would TestList become null and how do I order by on this List?