C# – Inconsistent accessibility error with the following c# code. Why

c++

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

Inconsistent accessibility: parameter type 'ClassLibrary1.Interface1' is less accessible than method 'ClassLibrary1.Class1.Class1(ClassLibrary1.Interface1)'

with the following code:

interface Interface1<T>
{
    bool IsDataValid();
    /* Other interfaces */
}

public class Class1<T>
{
    public Interface1<T> interface1;

    public Class1(Interface1<T> interface1)
    {
        this.interface1 = interface1;
    }

}

I've since designed my code differently using inheritence to but if anyone could tell me what the above is wrong I'd greatly appreciate it.

Best Solution

your "Interface1" isn't public..

public interface Interface1<T>
{
    bool IsDataValid();
    /* Other interfaces */
}
Related Question