Ruben
Ruben

Reputation: 1093

Save something in settingsfile or.. ? in C#

I am implementing an application and I have a few lists with some stuff in it, which is always the same, but I don't want to implement this in my real logic stuff.

Is there any way to save these items in your application? I've read some things about saving these items in a settingsfile.

Is this the best way, or there are better ways? and how can I do this?

Upvotes: 1

Views: 198

Answers (4)

Daniel Bişar
Daniel Bişar

Reputation: 2773

Save in XML. You can bind directly to xml in wpf. See: http://joshsmithonwpf.wordpress.com/2007/06/04/binding-to-xml/

Upvotes: 0

David Brunelle
David Brunelle

Reputation: 6450

Depending of the content itself, I like to load the content of list into a database table. For example, a list of school would be stored in a table calle T_Ref_Schools. The Ref indicated to me that those values can be changed over time but not often.

Upvotes: 0

ChrisWue
ChrisWue

Reputation: 19070

You can save it in the application settings file

Upvotes: 1

PVitt
PVitt

Reputation: 11770

If the content of the list is supposed to never be changed you can make them private static fields in a static class the provides a mthod to create a new instance of the list.

If the content of the list is supposed to be changed, it is a good idea to store it in the application settings file.

If the content of the list is supposed to be changed per user you should save it in the user settings file.

Upvotes: 0

Related Questions