user13657
user13657

Reputation: 765

Saving some info into application resource and read it from anywhere

Im wonder, is it possible, to save something in a field in output (exe) application file? For example if i want to save somewhere (but not in database) date when application had first start, and then after couple days check value when was first start?

Thanks.

Upvotes: 1

Views: 300

Answers (1)

Paul Sasik
Paul Sasik

Reputation: 81459

There are many options but do take a look at Using Settings in C# (also a newer set of articles here.)

This is a good way to persist simple data such as your example of first application start date/time w/o the need for a db or some other, "heavier", persistence scheme.

From the linked article:

The .NET Framework ... allows you to create and access values that are persisted between application execution sessions. These values are called settings. Settings can represent user preferences, or valuable information the application needs to use. For example, you might create a series of settings that store user preferences for the color scheme of an application. Or you might store the connection string that specifies a database that your application uses. Settings allow you to both persist information that is critical to the application outside of the code, and to create profiles that store the preferences of individual users.

Upvotes: 2

Related Questions