I have a dictionary. It contains Type and string:
var myDictionary = new Dictionary<Type, string>();
myDictionary.Add(typeof(Person), "Person");
myDictionary.Add(typeof(IPerson), "IPerson");
myDictionary.Add(typeof(IGoodStudent), "IGoodStudent");
myDictionary.Add(typeof(IStudent), "IStudent");
myDictionary.Add(typeof(GoodStudent), "GoodStudent");
myDictionary.Add(typeof(Student), "Student");
And my inheritance tree :
I want to sort my dictionary by dependency. First, it should look at inheritance then at implementation. In this case, my expectation is :
IPerson
Person
IStudent
Student
IGoodStudent
GoodStudent
How can I sort my dictionary?