I have some entities, that may or may not inherit from other objects, but they will implement an interface, lets call it IMyInterface.
public interface IMyInterface {
long MyPropertyName { get; set; }
}
An object will always implement this interface, but it may have been implemented on a class that the object inherits from. How can i get the name of the class that has this interface implemented?
Examples should give these results
public class MyClass : IMyInterface {
}
public class MyHighClass : MyClass {
}
public class MyPlainClass {
}
public class PlainInheritedClass : MyPlainClass, IMyInterface {
}
If i pass in MyClass, it should return MyClass, because MyClass implements the interface.
If i pass in MyHighClass, it should return MyClass, because MyClass was inherited, and it implements the interface.
If i pass in PlainInheritedClass, it should return PlainInheriedClass, because it inherited from MyPlainClass, but that did not implement the interface, PlainInheritedClass did
Aucun commentaire:
Enregistrer un commentaire