As the title says, how do you use reflection to check if a class definition is defined as internal? “typeof(…)” returns certain properties shown below but not whether a class is defined as internal. Looked on Google but all I could find were lots of articles about running internal or protected methods using reflection. It’s not the methods I’m interested in this case, but the class definition.
var type = typeof(Customer);
Assert.IsTrue(type.IsClass);
Assert.That(type.IsAbstract, Is.EqualTo(isAbstract));
Assert.That(type.IsPublic, Is.EqualTo(isPublic));
Assert.That(type.IsPublic, Is.EqualTo(isPublic));
Assert.That(type.IsSealed, Is.EqualTo(isSealed));
Assert.That(type.IsSerializable, Is.EqualTo(isSerializable));
This is a classic issue. From MSDN:
Reflection does not expose a way on
Typecheck if it isinternal,protectedorprotected internal.