Example error message: Inconsistent accessibility: field type ‘MyPublicClass’ is less accessible than field ‘MyPublicObject.MyPublicStaticClassObject’

We often use a public static class ApMain in our projects:

namespace my_projects_namespace
{
	public static class ApMain
	{

Within this we create other objects as public static, so they can be accessed throughout the app:

	public static MyClass MyClass1;

These can then be accessed using:

	ApMain.MyClass1

If you get this error when you add a new class to it, its because you’ve not made the new class public, you should have this:

namespace my_projects_namespace
{
	public class Udp
	{

Not this:

namespace my_projects_namespace
{
	class Udp
	{
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *