Reputation: 1
I have an internal class
namespace commonNamespace
{
internal class A{}
}
i have another public class within the same assembly
public class B{}
I want to declare an array of type A in classB. ex:
namespace commonNamespace
{
public class B
{
A[] array;
}
}
I am getting inconsistent accessibility Level error message.Please let me know how can i do this.
Upvotes: 0
Views: 112
Reputation: 8280
Just add access modifier to the field Array:
public class B
{
internal A[] array;
}
This is the Access Modifiers hierarchy:
public > protected > internal > internal protected > private
So just choose anything below protected and you will be fine.
Upvotes: 1
Reputation: 19416
You must have a public/protected field or property in B
exposing some instance(s) of type A
. Mark that as internal and you should be good to go.
Upvotes: 2