How can one store a double array in the settings of the program, and retrieve it later?
Code
string[,] user_credits = new string[user_credits_array, 10];
user_credits[new_user_id, 0] = user_name;
user_credits[new_user_id, 1] = user_email;
user_credits[new_user_id, 2] = user_acc_name;
user_credits[new_user_id, 3] = user_acc_pass;
user_credits[new_user_id, 4] = sSelectedClient;
user_credits[new_user_id, 5] = server_inkomend;
user_credits[new_user_id, 6] = server_uitgaand;
user_credits[new_user_id, 7] = server_port + "";
user_credits[new_user_id, 8] = ssl_state;
So as you can see, am i using the id of the user to store the info together. And I'm storing it this way:
Properties.Settings.Default.user_credits = user_credits;
Properties.Settings.Default.Save();
Am I doing it right? is now the array still in the user settings?
And how can I get it out of it (the settings with the right user id)?
I know it might sound crazy, but i think this is the best way. But if you guys know an better way, tell me. I
Edit 1:
I've got this piece of code:
string[,] user_credits = new string[user_credits_array, 10];
user_credits[new_user_id, 0] = user_name;
user_credits[new_user_id, 1] = user_email;
user_credits[new_user_id, 2] = user_acc_name;
user_credits[new_user_id, 3] = user_acc_pass;
user_credits[new_user_id, 4] = sSelectedClient;
user_credits[new_user_id, 5] = server_inkomend;
user_credits[new_user_id, 6] = server_uitgaand;
user_credits[new_user_id, 7] = server_port + "";
user_credits[new_user_id, 8] = ssl_state;
MySettings settingsTest = new MySettings();
settingsTest.Save(MySettings.GetDefaultPath());
MySettings anotherTest = MySettings.Load(MySettings.GetDefaultPath());
And after running the code, this is how the XML file looks like:
<Complex name="Root" type="WeProgram_Mail.MySettings, WeProgram_Mail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<Properties>
<Null name="user_credits" />
</Properties>
Now I don't understand why the array isn't saved. Because I've got this line
public string[,] user_credits { get; set; }
And I thought that would pick up the usersettings from the array, but somehow they don't.