[C#] Inconsistent accessibility
Phenomenon
In C #, the following code causes a title compilation error.
This error occurs when, for example, the class is private but the method is public, but in this example both are public.
public class MyClass{
public MyClass(OtherClass data){ //error here
//omit
}
Cause and Solution
The constructor argument OtherClass was private.
When I changed this to public, the compile error disappeared.
It was a trivial error, but it was a blind spot because I was only concerned about the accessibility of class and method.
Recent Posts
See AllProblem When I execute an external program with Process.start, it does not work as expected and exits with exit code 2 (no exceptions)....
Comentarios