Stopbyte

How to fix "Inconsistent accessibility" property type is less accessible error in C#?

hello programmers!

please sommeone can helpe me to fix this issue

this is My source code :

namespace test
{
  Class A
{
     private String x;
     ............
}
Class B
{
    private A teste;
    public A getTest
    {
      get{return teste;}
    }
}
}

I’m not able to run the program due to the error message of inconsistency.

this is the error message

Inconsistent accessibility: property type ‘Test.A’ is less accessible than property ‘Test.B.getTest’

2 Likes

it is very easy just make your class public access modifier, add public keyword infront of your class name.

Please read the OOP documents, since that’s a basic notation on OOP and C#.

The problem is as follows:

You can’t have a More-Accessible (Public) method or member in a Less-Accessible Class (Private).