How to solve the Error: Inconsistent accessibility: parameter type for generic c# interface?

后端 未结 5 824
不知归路
不知归路 2021-01-04 06:25

On writting this code into my project i am getting the error that

Error 1 Inconsistent accessibility: field type \'System.Collections.Gene

5条回答
  •  孤城傲影
    2021-01-04 06:54

    Without posting your entire relevant code i'll try a hunch:

    the class Childrendata is declared as not-public and (as we can see) the variable m_children is public

    Threfore a public variable cannot expose a less accessible type, in this case, Childrendata

    Additionally, what you might want is to turn m_children private as well as this is usually the best practice

提交回复
热议问题