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.
your "Interface1" isn't public..
public interface Interface1<T>
{
    bool IsDataValid();
    /* Other interfaces */
}
                        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.
second solution is If your interface is not public then dont make your class public where you are making a handle of interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With