This is a confusing error if you’re busy coding away and don’t step back to think about it.
In a nutshell, you are providing access to an object, and the access scope on that object does not match (aka is inconsistent) that of the providing method.

For e.g. if you define an interface IFoo and forget to mark it as public, and create a public Factory method returning an object implementing IFoo, you will get an “Inconsistent Accessibility” error at compile time.
It is pretty obvious if you think about it; the Factory method is public but the Interface is not, and you are returning a private (aka inaccessible) object via a public accessor, which doesn’t make sense.

So, to resolve it, start where the error occurs (by double-clicking the error) and then start drilling down the object hierarchy to see where the access changes from open to more restrictive, e.g. public to private.

Hope that helps…

Advertisements