0

I get an error in the code below on the first mention of the word tables. I need that dictionary to be usable by all classes.

the error reads:

Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.Dictionary' is less accessible than field 'RiskRatingReevaluation.RiskRatingLogic.tables' C:\Users\jholland\Documents\Visual Studio 2012\Projects\RiskRatingReevaluation\RiskRatingReevaluation\RiskRatingLogic.cs 13 49 RiskRatingReevaluation

public static class RiskRatingLogic
{

    public static Dictionary<string, Table> tables;

    public static void Main()
    {

        tables = new Dictionary<string, Table>();
        ImportRegionIndexes(tables);

Any suggestions of what to change?

steveax
  • 17,527
  • 6
  • 44
  • 59
jth41
  • 3,808
  • 9
  • 59
  • 109

2 Answers2

3

It sounds like your Table class is not public. The error is exactly as it sounds, one class is less accessible (public, internal, private, protected) than the one calling it

Take a look at the accessibility levels

Justin Pihony
  • 66,056
  • 18
  • 147
  • 180
  • 1
    I changed that but was still getting the error. turns out that I had to clean the solution to make the error disapear – jth41 Apr 05 '13 at 16:09
0

As suggested by Justin Pihony Changing the class access modifier should solve the problem. I too was facing the same problem.

Ujjwal Roy
  • 500
  • 6
  • 9