Inconsistent accessbility
hi every one iam having one doubt about the above subject explain it briefly thank u every one
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 7, 2014, 2:00 AM EDT
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