I’ve got a class that looks something like this:
public class Parent { public class Subclass { } }
and using reflection I’m trying to find the subclass
void main { Parent p = new Parent(); Type t = p.GetType(); Type s = t.GetNestedType('Subclass'); //s is not set }
This doesn’t work because there apparently are no nested types. How can I find the type of the subclass? The reason I need to get s is to later call .GetMethod(‘someMethod’).Invoke(…) on it.
I just tried the exact same thing, and it worked for me:
Are you sure the NestedClass is public?