I have a requirement in which i need to get the types as below
public class Class1
{
}
public class Class2 : Class1
{
}
public class Class3 : Class1
{
}
I can call the Assembly.GetTypes() on the target assembly and add all the classes that derive from Class1. I am ordering the types so that next time, that order will be used.
That order is essential for internal serialization and deserialization as the internal engine depends on the index of the type rather than the type name. I can not alter the serialization engine.
If in future a new class Class4 is derived from Class1, then it should come in the order after Class3.
I am not able to think of a solution that is feasible.
Do, i need to maintain a xml file in which the order of the types are preserved and if i encounter a new type, should that be added at the end of xml?
Please help