Initializing dictionary with a struct? help pls
-
Hi guys what is wrong with this line? lookupObject is a struct. I just want to initialize the dictionary with the struct as value. public static Dictionary dicTextLookup = new Dictionary(); this is the error: "Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.Dictionary' is less accessible than field 'dicTextLookup' C:\IL\TranslationController.cs 44" Thanks
-
Hi guys what is wrong with this line? lookupObject is a struct. I just want to initialize the dictionary with the struct as value. public static Dictionary dicTextLookup = new Dictionary(); this is the error: "Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.Dictionary' is less accessible than field 'dicTextLookup' C:\IL\TranslationController.cs 44" Thanks
Could you repost that snippet, but check the "Ignore HTML tags in this message" checkbox when posting? We can't see your full code otherwise. Is dicTextLookup non-public? Are you exposing the field as public? This error typically occurs if you're trying to expose some private/protected/internal thing as public. For instance
private class MyFoo {}
public class MyBar()
{
public MyFoo instance; // Error: inconsistent visibility: MyFoo is private, yet we're trying to expose the field as public
} -
Could you repost that snippet, but check the "Ignore HTML tags in this message" checkbox when posting? We can't see your full code otherwise. Is dicTextLookup non-public? Are you exposing the field as public? This error typically occurs if you're trying to expose some private/protected/internal thing as public. For instance
private class MyFoo {}
public class MyBar()
{
public MyFoo instance; // Error: inconsistent visibility: MyFoo is private, yet we're trying to expose the field as public
}Sorry I didnt know about checking the checkbox, you solved my problem without looking at my code. Great!