I have a List that has various derived classes. I may have something like this:
List<BaseClass> list = new List<BaseClass>() {
new Class1(),
new Class2(1),
new Class3(),
new Class2(2),
new Class4()
};
I am trying to use LINQ to semi-sort the list so that the natural order is maintained EXCEPT for Class2. All Class2 instances should be grouped together at the place that the first Class2 occurs. Here is what the output should be like:
List<BaseClass> list = new List<BaseClass>() {
new Class1(),
new Class2(1),
new Class2(2),
new Class3(),
new Class4()
};
I can't for the life of me figure out how to do this...