Reputation: 3459
Sorry I'm kinda new to c# how would I make a class where I can access it like this: Myclass.subclass.method();
This is what I have now:
namespace zzcore
{
class myclass
{
class subclass
{
public static void method() { }
}
}
}
Upvotes: 2
Views: 1829
Reputation: 24088
What happens here is that a nested class without a visibility modifier is implicitly private
. In this context, private
means that only the parent class can see it.
Declare both classes as public
and you will be able to call myclass.subclass.method();
namespace zzcore
{
public class myclass
{
public class subclass
{
public static void method() { }
}
}
}
Working example: http://ideone.com/tJVKJ
Upvotes: 7