Internal classes

M

Michael C

Hi all

I can access an internal class by this method if I do it within the
namespace

{
namespace ClassTest

public class1
{
internal class class2
{
}
}

public class Tester
{
class1.class2 myclass2 = new class1.class2
}
}


but if I try outside the namespace say the above is in a dll and in a
different
project I add a reference to the dll

ClassTest.class1.class2 >>> doesn't show up or work if set to internal
I need to change internal to public to access
Is that normal?

Regards

Michael
 
H

hOSAM

Michael C said:
Hi all

I can access an internal class by this method if I do it within the
namespace

{
namespace ClassTest

public class1
{
internal class class2
{
}
}

public class Tester
{
class1.class2 myclass2 = new class1.class2
}
}


but if I try outside the namespace say the above is in a dll and in a
different
project I add a reference to the dll

ClassTest.class1.class2 >>> doesn't show up or work if set to internal
I need to change internal to public to access
Is that normal?

Yes, it is. 'internal' is used to define object that are only to be usable
within a single library (DLL). That is to say, your internal class is
handled like public classes inside your first DLL, but it looks like a
private class from the point of view of other projects or executables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top