First time with this error - Inconsistent accessibility

后端 未结 3 1176
广开言路
广开言路 2021-01-20 15:11

This is my first time working with interfaces and proper namespace structure. When I compile I get the error below, I have no idea what it means. Any searches I do shows up

相关标签:
3条回答
  • 2021-01-20 15:41

    IOperatorRequest is internal which is less accessible than public.

    Top-level types, which are not nested in other types, can only have internal or public accessibility. The default accessibility for these types is internal.

    from MSDN

    0 讨论(0)
  • 2021-01-20 15:42

    You have a public property on a public class that exposes a list of non-public types.
    You need to change IOperatorRequest to be public or change the UrlBuilderO2 class or GetUrlReuests method to be non-public.

    0 讨论(0)
  • 2021-01-20 15:55

    The problem is IOperatorRequest is probably internal.

    UPDATE

    What I said is correct. Omitting modifier makes it internal.

    Classes and structs that are declared directly within a namespace (in other words, that are not nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.

    0 讨论(0)
提交回复
热议问题