Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

c# - How to save a List<string> on Settings.Default?

I have a ListBox on my Form, I want to save it and load the values when I start the application again.

How can I save a list on PrjName.Properties.Settings.Default?

Question&Answers:os

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

1 Answer

0 votes
by (71.8m points)

No problem at all! Create a new setting, e.g. "MyListOfStrings", type doesn't matter.

enter image description here

then open settings file in a xml editor

enter image description here enter image description here

your file will look like this:

enter image description here

now change it as shown below and save it

enter image description here

well, that's all, now it will look like that:

enter image description here

and in code:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...