I'm a newbie at programming. I have this php code, it's basically used for translating some sentences from txt files:
$LANG = array();
$LANG['en'] = array(
11 => "Name",
20 => "Surname",
21 => "Age",
22 => "Profession",
);
$LANG['es'] = array(
11 => "Nombre",
20 => "Apellido",
21 => "Edad",
22 => "Profesión",
);
I'm trying to do the same in c#, something like this:
Dictionary<int, string>[] LANG = new Dictionary<int, string>[]
{
new Dictionary<int, string>(),
LANG['en']=new Dictionary<int, string>()
{
{11, "Name"},
{20, "Surname"},
{21, "Age"},
{22, "Profession"}
},
LANG['es']=new Dictionary<int, string>()
{
{11, "Nombre"},
{20, "Apellido"},
{21, "Edad"},
{22, "Profesión"}
}
};
1) Is this c# doing exactly the same as the php code? Should i do an array of dictionaries, or should i do a dictionary of dictionaries?
2) For LANG['en']
and LANG['es']
, i'm getting the error message "A field initializer cannot reference the non-static field, method or property 'Form1.LANG'. What am i doing wrong?