Expand To Show Full Article
C# Error CS0107 – More than one protection modifier

C# Error CS0107 – More than one protection modifier

C# Compiler Error

CS0107 – More than one protection modifier

Reason for the Error

In C#, you are allowed to have only one access modifier on a class member. However, there is an expected when you use protected internal and private protected. Apart from these 2 access modifiers you cannot have more than one access modifiers for a class member.

You will receive this error when you marked your class with multiple access modifiers.

Try compiling the below code snippet and you will receive the CS0107 error.

public class Class1
{
    private internal void Method1()  
    {
    }
}

public class DeveloperPublish
{
    public static void Main()
    {

    }
}
C# Error CS0107 – More than one protection modifier

Solution

To fix the above error, remove the multiple access modifier and ensure that only one access modifier is used.