I have a low quantity of data to persist in my .NET app. For example, the file that has been opened last time when the user was around. What is the best practice to persist and retrieve information like that? A code sample would be appreciated.
James's direction is helpful, but bear in mind , what type of application? there are differences between web apps and windows apps. Look at cookies, session state appropriate for web apps.
A useful way is to extend the profile provider
http://msdn.microsoft.com/en-us/library/taab950e.aspx
The profile provider remembers info after session has ended. Alternatively, sql server provides great permanent storage for creating your own state handler
.NET has this built in go to your project settings you can have per user and per aplication settings persisted extremely easily.
I've struggled with this question for a very long time, but finally ive found a solution that works superb for me.
Create a settings class containing all simple settings (i.e. one value) Create a class for every setting that has to return multilpe values
Find yourself a nice ORM (i like xpo very much, but bear in mind that that is a commercial solution).
The ORM does all the work (at least, if you have a nice one).