在我的Properties.Settings.Default中有一个设置属性,它是一个" string“(一个由string数组构建的字符串数组)。我把它设置成这样,它看起来就像VS正确地阅读它:
<Setting Name="Markers" Type="System.String[][]" Scope="User">这是我的代码:
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" };其余代码与Properties.Settings.Default.Markers无关。我刚开始处理这个
编辑:我发现按钮是空的。我发现初始化它的唯一方法是: Properties.Settings.Default.Markers =newstring100;问题是它中最多有100个数组。我的问题是,有没有办法在不设置长度的情况下初始化它?
发布于 2014-05-09 05:58:45
我继续搜索了很多次,发现了以下内容:How to store a list of objects in application settings
这回答了我的问题,对我帮助很大。
https://stackoverflow.com/questions/23552316
复制相似问题