Pergunta

I have a settings property which is a "string[][]" (a string array built of string arrays) inside my Properties.Settings.Default. I set it up like this, and it seems as VS reads it properly:

<Setting Name="Markers" Type="System.String[][]" Scope="User">

Here is my code:

string[][] buttons = (string[][])Properties.Settings.Default.Markers;
buttons[0] = new string[] { "pause", "", "0", "255", "0" }; // Object reference not set to an instance of an object - here

buttons[1] = new string[] { "pause", "", "0", "255", "0" };

buttons[2] = new string[] { "effect", "", "255", "0", "0" };

buttons[3] = new string[] { "interest", "", "255", "255", "0" };

buttons[4] = new string[] { "cut", "", "0", "255", "255" };

The rest of the code is not related to Properties.Settings.Default.Markers. I just started dealing with this

edit: I found that buttons is a null... The only way I found to initialize it is this: Properties.Settings.Default.Markers = new string[100][]; the problem is it has a max of 100 arrays in it. My question is is there any way to initialize it without setting a length?

Foi útil?

Solução

I continued searching quite a lot and found this: How to store a list of objects in application settings

This answered my questions and helped me a lot

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top