Search code examples
c#arcgis

saving variable values after execution stops


I am developing a vc# app using arcgis runtime sdk. For data types like int string etc. I would store variable values in txt file n then access it using parse or tostring method. But the variables that the arcgis sdk provides i can store the value but then cant assign it after rerunning the program. Any suggestions??


Solution

  • Looks like the classes have methods to convert to/from JSON.

    Geometry.ToJson Method
    Geometry.FromJson Method

    So instead of ToString and Parse functions, use the ToJson and FromJson to store and load the values from a file (ToJson returns a JSON formatted string for an object, and FromJson takes a JSON formatted string to generate an object).

    For reference: JSON