Object source

Location: main sources module.

ObjectSource converts an arbitrary object (including anonymous types) to a settings node:

var source = new ObjectSource(new {A = 1, B = 2, C = new[] {1, 2, 3});

Conversion process obeys the following priority list:

  • Objects with overridden ToString are converted to value nodes;

  • Dictionaries with primitive key types are converted to object nodes;

    • Conversion is performed recursively for keys and values;

  • Objects that implement IEnumerable are converted to array nodes;

    • Conversion is performed recursively for sequence elements;

  • Everything else is converted to object nodes;

    • Conversion is performed recursively for public instance fields and properties;

Like constant sources, object source does not produce any updates by itself; conversion exceptions are exposed via (null, error) notifications.

pageConfiguration sources

Last updated