Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

wpf - Use an Array of StringCollection in C# settings

i need some help with the settings function of c#.

I have a tool which calculates dilutions of samples based on given target concentration and volume and source concentrations.

The information about the target volumes depends on the kit which will be used. These kits shall be stored in an array of stringcollections, wherein one stringCollections holds all values(name, volumes, concentrations...) for one kit.

The reason why i want to use an array of stringCollections is, that the user shall have the option to add more kits on runtime. Therefore i could just append a new stringCollection to the array and build my dropdown entries by iterating over the array and get all names of the defined kits.

When i define a new setting in the Settings.settings file like this:

    <Setting Name="allKitsArray" Type="System.Collections.Specialized.StringCollection[]" Scope="User">
      <Value Profile="(Default)" />
    </Setting>

i can access it in the Settings Window in VisualStudio but when i try to add a new StringCollection it gives me the error, that System.String has no Constructor method.

I hope the problem is clear otherwise i would be happy if you could point out the missing informations you need.

Update @Pierre Michel I try to add them in the Project Properties -> Settings (see Error Message from Visual Studio)

As you can see adding to the array is no problem, but when the second editor opens and i try to add a string collection, i get the error message with no constructor for string

question from:https://stackoverflow.com/questions/65884949/use-an-array-of-stringcollection-in-c-sharp-settings

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...