The exception “Error CS0053 Inconsistent accessibility: property type is less accessible than property” is one of the confusing exceptions we can find while programming with C# .Net. Here in this small article, I am going to explain how to get rid of this exception.
The syntax error “Error CS0053 Inconsistent accessibility: property type is less accessible than property” may be displayed in the visual studio when the user working with property types. In my case, this issue was found for the above code shown in the screenshot.
To solve the above issue I supposed to remove the public access modifier as shown below screenshot. The same problem I could observe in one of the classes in my project and I could solve the issue by just removing the public access modifier.
The reason for the issue is when the class or interface has public access modifier and the property of the class or interface has no access modifier, which means it defaults to internal, it won’t work. Property needs to have the same or higher access as a class or interface.
Vice versa of the above reason, when the class or interface has no access modifier, that means it defaults to internal and property is having public access modifier, this will not work. Because class or interface needs to have the same or higher access as property.
The simplest fix for this issue is to add or remove the public access modifier to the class or interface. Because as per the above explanation, this issue will occur when two different access modifiers for class/interface and property. Then one of the access modifiers is less accessible than others.