Why are inner class not public when viewed in reflection?

.net, c#, reflection

Solution

It fails because nested types are not considered Public, they are considered `NestedPublic` instead.

From the `IsPublic()` MSDN documentation:

Do not use with nested types; use `IsNestedPublic` instead.

Problem

AKA why does this test fail? ``` [TestFixture] public class Tests { [Test] public void InnerClassShouldBePublic() { Assert.IsTrue(typeof (InnerClass).IsPublic); } public class InnerClass { } } ```

Original source