https://github.com/ntdls/ntdls.persistence
Helpers for reading and writing serialized objects to/from files. Helpful for configuration files.
https://github.com/ntdls/ntdls.persistence
disk-io persistence preferences serialization
Last synced: about 2 months ago
JSON representation
Helpers for reading and writing serialized objects to/from files. Helpful for configuration files.
- Host: GitHub
- URL: https://github.com/ntdls/ntdls.persistence
- Owner: NTDLS
- License: mit
- Created: 2023-11-03T14:13:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-22T20:51:33.000Z (over 2 years ago)
- Last Synced: 2024-04-26T11:46:12.001Z (about 2 years ago)
- Topics: disk-io, persistence, preferences, serialization
- Language: C#
- Homepage: https://networkdls.com/
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NTDLS.Persistence
📦 Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.Persistence
Helpers for reading and writing serialized objects to/from files. Helpful for configuration files.
```cs
class UIPreferences
{
public string Username { get; set; } = string.Empty;
public bool RememberPassword { get; set; }
}
static void Main(string[] args)
{
//Example of saving preferences:
var preferences = new UIPreferences()
{
Username = "JPatterson",
RememberPassword = false
};
//The file will be given the name of the class type and the given program
// name and will be stored in the common programs data directory.
CommonApplicationData.SaveToDisk("MyProgramName", preferences);
//Exmaple loading preferences:
var loadedPreferences = CommonApplicationData.LoadFromDisk("MyProgramName");
}
```