c# - Storing a variable in project -


i looking @ simple wpf c# project calculate employee tax payment uk company. need store uk tax allowances updated infrequently. these values shall 10000 , 45000 ( these not actual numbers know), may need updated in future. plan store app on central network.

i have considered using resources store these values take ability of user update these values away, not want do.

i have looked @ isolated storage like here think different users change tax limits when need each allowance stored , updated ever user update.

everything have read app.config file suggests not right place either such variable.

so should store data? guess put down txt or xml file, fine in case, not strike secure option , linking sql db seem on top

what best practice in case pls?

thank you

if security extension doesn't matter serialize values file. json nice , simple (using json.net). if need have more allowances, make array instead of upper , lower.

define class;

public class allowances     {         public decimal lowerallowance { get; set; }         public decimal upperallowance { get; set; }     } 

then can serialize/deserialize file.

        var allowances = new allowances         {             lowerallowance = 10000m,             upperallowance = 45000m         };          file.writealltext("allowances.json", jsonconvert.serializeobject(allowances));          var readallowances = jsonconvert.deserializeobject<allowances>(file.readalltext("allowances.json"));          console.writeline(readallowances.lowerallowance);         console.writeline(readallowances.upperallowance); 

you can create screen in app loads values up, saves them back.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -