Syntax to save Dictionary<string, float> using ES3?

Discussion and help for Easy Save 3
Post Reply
mdotstrange
Posts: 11
Joined: Fri Aug 19, 2016 11:57 pm

Syntax to save Dictionary<string, float> using ES3?

Post by mdotstrange »

I know I'm missing something simple to get this working-

I'm using EasySave3 and saving using the ES3File function- I have a fully working save/load system with all other types except dictionaries-

What is the syntax to Save/Load a Dictionary of <string,float> using EasySave3? Using an ES3File to save to?

Could anyone just post two lines of code- save and load for this purpose? Thank you.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Syntax to save Dictionary<string, float> using ES3?

Post by Joel »

Hi there,

The code would be:
var file = new ES3File(); // Create an ES3File using the default file name.
file.Save<Dictionary<string,float>>("myDictionary", myDictionary); // Save a dictionary to the ES3File.
file.Sync(); // Write file to disk.
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
mdotstrange
Posts: 11
Joined: Fri Aug 19, 2016 11:57 pm

Re: Syntax to save Dictionary<string, float> using ES3?

Post by mdotstrange »

Here's the answer for anyone else that needs it-

Code: Select all

//file is ES3File
//To Save
file.Save<Dictionary<string,float>>("DataDict",dict);

//To Load
file.Load<Dictionary<string, float>>("DataDict");
mdotstrange
Posts: 11
Joined: Fri Aug 19, 2016 11:57 pm

Re: Syntax to save Dictionary<string, float> using ES3?

Post by mdotstrange »

Thanks Joel! I had just figured it out and posted at the same time as you ^_^ Cheers and thanks again for the great product :D
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Syntax to save Dictionary<string, float> using ES3?

Post by Joel »

mdotstrange wrote:Thanks Joel! I had just figured it out and posted at the same time as you ^_^ Cheers and thanks again for the great product :D
No problem, let me know if you run into any other issues :D

- Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply