Nucs / JsonSettings

This library simplifies creating configuration for your C# app/service by utilizing the serialization capabilities of Json.NET to serialize nested (custom) objects, dictionaries and lists as simply as by creating a POCO and inheriting JsonSettings class.
MIT License
76 stars 18 forks source link

How to use Autosave in Hardcoded Setting file #7

Closed ghost1372 closed 6 years ago

ghost1372 commented 6 years ago

hi again, tnx for update, i have problem can you explain more about how to use? this code is fine var x = JsonSettings.Load<mysetting>("config.json").EnableAutosave(); but i need to use like this public static JsonSettings Settings = JsonSettings.Load<mysetting>("config.json").EnableAutosave(); problem is i cant access my prop like this: x.myprop

Nucs commented 6 years ago

Hey, EnableAutosave(); returns what ever you feed it, so if its mysettingthen it'll return mysetting. Simply change the declaration and loading to this: public static **mysetting** Settings = JsonSettings.Load<mysetting>("config.json").EnableAutosave();

Edit: I've updated the documentation to be more newbie-friendly.

ghost1372 commented 6 years ago

tnx problem solved