Don't post code as a solution - that removes your question from the "unanswered" list and make it less likely to be looked at. I moved your code into the question, and deleted your "answer"
"Inconsistent accessibility" means that you are trying to add something which is declared as more available than the class that contains it.
For example, a
internal
class with a
public
method:
internal class MyClass
{
public void MyMethod (){}
}
Because the class is
internal
it is only accessible within files in the same assembly, outside the assembly it can't be used or even referenced at all.
But
MyMethod
is
public
, which means it can be used anywhere at all. So how can anyone use it? They can access
MyMethod
, but not declare or use a variable of type
MyClass
- which means
Mymethod
is a
public
method that can't be used outside the same assembly!
And that's what the error message is saying: "Inconsistent accessibility": "the accessibility of the method is greater than the accessibility of the class that contains it so it can't be used as you might expect"
Change your class to
public
, or change your method to match (or be less accessible than) the class.