✅ Storing information
What is the best way to save/load information on startup and closing program?
13 Replies
there is no one best way, but if you just want a suggestion to start with you can use System.Text.Json to convert a C# object to and from text and store it in a file
there are different formats, databases, etc that may be more or less appropriate depending on the details of what you're trying to do
I basically have to store 4 strings as 1 object
and I have to edit and save the file on a button click event
my suggestion is probably your best option then, assuming your course doesn't have any restrictions on how to do it or what libraries you can use
I will try it
I will create a backup of my project first
I checked microsoft learn and they dont have anything there on json
am I supposed to be using Newtonsoft.Json?
in general, go with System.Text.Json nowadays
is newtonsoft the same as regular json?
are there any free tutorials you can recommend?
I know what json does but have not really used it before
when I was doing java
newtonsoft.json is just a library to work with json, it was the common one before system.text.json was added to .net
oh okay
I need to find a tutorial on that
Serialize and deserialize JSON using C# - .NET
This overview describes the System.Text.Json namespace functionality for serializing to and deserializing from JSON in .NET.
ay ay captain
are there any dangers in using json?
my program wont start
when you say it won't start what does that mean exactly
got it working sort of