Table of Contents

Method WriteToJsonFile

Namespace
UICatalog.Scenarios
Assembly
UICatalog.dll

WriteToJsonFile<T>(string, T, bool)

Writes the given object instance to a Json file.

Object type must have a parameterless constructor.

Only Public properties and variables will be written to the file. These can be any type though, even other classes.

If there are public properties/variables that you do not want written to the file, decorate them with the [JsonIgnore] attribute.

public static void WriteToJsonFile<T>(string filePath, T objectToWrite, bool append = false) where T : new()

Parameters

filePath string

The file path to write the object instance to.

objectToWrite T

The object instance to write to the file.

append bool

If false the file will be overwritten if it already exists. If true the contents will be appended to the file.

Type Parameters

T

The type of object being written to the file.