Inconsistent accessibility error with the following c# code. Why?

后端 未结 3 818
小鲜肉
小鲜肉 2020-11-29 09:12

Whats wrong with the following c# code? Compiler reports this error:

Inconsistent accessibility: parameter type \'ClassLibrary1.Interface1\' is less accessible than

相关标签:
3条回答
  • 2020-11-29 09:41

    Mark your interface as public:

    public interface Interface1<T>

    If you leave out the accessibility label, it defaults to internal, that is, only accessible to other classes within the assembly.

    0 讨论(0)
  • 2020-11-29 09:54

    your "Interface1" isn't public..

    public interface Interface1<T>
    {
        bool IsDataValid();
        /* Other interfaces */
    }
    
    0 讨论(0)
  • 2020-11-29 09:54

    second solution is If your interface is not public then dont make your class public where you are making a handle of interface.

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