D
D
Denis Mashanov2017-09-13 17:09:55
WPF
Denis Mashanov, 2017-09-13 17:09:55

Is it possible to save a list (List) in resources or in the application settings?

Good afternoon. Is it possible to save a list (List) in resources or in the application settings? That is List and for convenience would like to store the list. I know alternative options, but exactly how to save the List?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
eRKa, 2017-09-13
@kttotto

Option one is the easiest. In advance, in the networking, make a string type field for the list. Serialize the list in json and save it there. Well, when reading, you read the line and deserialize into your list.

var listStr = JsonConvert.SerializeObject(new List<Any>());
Properties.Settings.Default.MyList = listStr;

listStr = Properties.Settings.Default.MyList;
var list = JsonConvert.DeserializeObject<List<Any>>(listStr);

And the second option, generally programmatically well described here

D
d-stream, 2017-09-13
@d-stream

For example serializing...

D
Dmitry Eremin, 2017-09-13
@EreminD

dap

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question