Tag Archives: deserialization

Extract part of a JSON file in C#

This example shows how to read a JSON file and pick out only the pieces that are interesting. Recall from my post Anatomy of an example that my original goal with this series of articles was to write a program … Continue reading

Posted in algorithms, files, serialization | Tagged , , , , , , , , , , , , , | 1 Comment

Use JSON to serialize and deserialize objects in C#

JSON (JavaScript Object Notation) is a standard for textual storage and interchange of information, much as XML is. Before you roll your eyes and ask if we really need another language to do what XML does, consider how verbose XML … Continue reading

Posted in algorithms, serialization | Tagged , , , , , , , , , , , , | 1 Comment

Save and restore line drawings in C#

The example Draw and move line segments in C# shows how to build a simple line editor. This example adds the ability to save and restore drawings. The first step is to save all of the drawing information in a … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | 7 Comments

Control serialization and deserialization in C#

For information on basic serialization and deserialization, see Serialize and deserialize objects in C#. By placing attributes on a class’s properties, you can control how those properties are serialized. The following code shows a Person class that demonstrates several XML … Continue reading

Posted in algorithms, serialization | Tagged , , , , , , , | Leave a comment

Let the user zoom on a picture in C#

The example Provide autosave in C# explains how to make a program that lets the user draw lines in different colors and styles. That program lets the user undo and redo, save and load drawings, and autosaves so it can … Continue reading

Posted in drawing, files, graphics, serialization | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Provide autosave in C#

This example extends the scribble example (most recently described in the post Provide undo and redo in C#) so it provides an auto-save feature. The following code creates the name of the program’s auto-save file. // The auto-save file name. … Continue reading

Posted in drawing, files, graphics, serialization | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Provide undo and redo in C#

This example adds undo and redo features to the example Save and restore pictures drawn by the user in C#. It’s not terribly hard, but it is long so I’ll break it into sections to make it easier to understand. … Continue reading

Posted in drawing, graphics, serialization | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Save and restore pictures drawn by the user in C#

The example Let the user scribble with different line styles in C# explains how to let the user draw curves with different colors, line thicknesses, and dash patterns. This example adds the ability to save and load pictures drawn by … Continue reading

Posted in drawing, graphics, serialization | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , | 3 Comments