Inconsistent Accessiblity Error in static class
I'm getting inconsistent accessibility error in the following declaration:
public static class Helper
{
public static void GetMyDictionary(Dictionary<string, string> dict)
{
dict = new Dictionary<string, string>();
// continue to do something
}
}
开发者_运维问答
Anyone know which part of it is causing the error?
I 'm going to go out on a limb here and say that the Dictionary
class this code refers to is not in fact System.Collections.Generic.Dictionary
, but some other Dictionary
that exists in your project. If the accessibility of this class is not public
, the compiler will complain that you cannot expose to the world the method GetMyDictionary
if one of its parameters is of a type not accessible to said world.
If this is not the case, then the problem is somewhere else and not in the code you give.
In any case, posting the exact error message would help reduce the guessing.
精彩评论