1

What is the following error :

Inconsistent accessibility: parameter type '----.Messagetypes' is less

accessible than method '---.MessageBox---.Messagetypes, string)'

my code :

public partial class Global
{
    private  enum Messagetypes { Error };

    public  void MessageBox(Messagetypes MessageDisplay, string MessageError)
    {

    }
}

What is the correct code

Community
  • 1
  • 1
mrJack
  • 1,001
  • 6
  • 17
  • 33
  • In the future post the exact error including the line number, and then supply the class the error is in, otherwise its hard to help you. I do not believe you can even declare an emumeration as private. – Security Hound Aug 05 '11 at 17:07
  • @Ramhound It seems like you actually can, I wrote `private enum MyEnum{ one, two}` in a class and it compiled fine, contrary to what [MSDN](http://msdn.microsoft.com/en-us/library/ba0a1yw2.aspx) says. – Jakub Aug 05 '11 at 17:31
  • @Rahmhound Why would you not be able to declare an enumeration as private? – Kyle W Aug 05 '11 at 19:24

2 Answers2

9

Messagetypes is private, but is a parameter to a public function. The only people that would ever be able to call it are other private members. Either change your function to private, or change your enum to public.

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
Kyle W
  • 3,702
  • 20
  • 32
0

You can't have Messagetype be private since apparently your application is trying to use it outside of the Global class. Change it to public and it should work.

Jakub
  • 534
  • 3
  • 17