I have some classes that inherit from a base class and I have other classes that inherit from nothing:
public class SomeDerivedClass : BaseClass
and
public class FreeFromInheritanceClass
{
}
I want to find FreeFromInheritanceClass
and other classes like it.
I tried this code but iI want to find FreeFromInheritanceClass
and other classes like it.
I tried this code but it does not work:
typeof(Program)
.GetTypes()
.Where(i => i.BaseType == null)
I found out that my FreeFromInheritanceClass
in fact inherits from System.Object
.
So, how can I find the classes that do not inherit from anything?t does not work:
typeof(Program)
.GetTypes()
.Where(i => i.BaseType == null)
I found out that my FreeFromInheritanceClass
in fact inherits from System.Object
.
So, how can I find the classes that do not inherit from anything?
Aucun commentaire:
Enregistrer un commentaire