I was having the problem of wanting a property to have an internal getter and a protected setter, as described in this question, and I thought I solved that by doing the following:
public class Accessor : AccessorBase
{
private Connection _connection;
protected void setConnection(Connection value)
{
_connection = value;
}
internal Connection GetConnection()
{
return _connection;
}
...
}
However, I'm now getting this error:
Inconsistent accessibility: parameter type 'Connection' is less accessible than method 'setConnection(Connection)'
This is because I have internal class Connection
. I would rather not make Connection
a public class, while Accessor
needs to be public, so how can I get around this error while still maintaining an internal getter and a protected setter?