inconsistent accessbility
hi every one iam having one doubt about the above subject explain it briefly thank u every one
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Aug 7, 2014, 6:00 AM
public class MyClass
{
public void MyMethod(YourClass yc)
{
Console.WriteLine(yc.ToString());
}
}
internal class YourClass
{
}
Note that both MyClass and MyMethod are public and so can be accessed from outside the current assembly.
However, YourClass is internal and so can't be accessed from outside the current assembly. This means that an outside caller would be unable to call MyMethod because (s)he wouldn't be able to access YourClass and is a simple example of inconsistent accessibility.
For a more complete discussion, check out this MSDN link:
http://msdn.microsoft.com/en-us/library/cx03xt0t.aspx