Skip to content
ConsoleMonster
Class

ShapeOptions

ConsoleMonster.Values

Namespace
ConsoleMonster.Values
Assembly
ConsoleMonster
Modifiers
sealed
Attributes
Fluent

Options for ValueShaper: how records are read and how values become text.

Inheritance

  • object
  • ShapeOptions

Usage

Explore 72 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 44

Constructors

public ShapeOptions() #

Methods

public ShapeOptions Clone() #

A copy with the same adapters, delegates and limits.

Returns

ShapeOptions The copy.

Properties

public IList<IMemberSource> Sources { get; } #

Record adapters tried before the built-in ones (for example PowerShell objects).

public Func<object, object>? Unwrap { get; set; } #
Fluent("UnwrapBy")

Turns a wrapper into the value it wraps (for example a PowerShell object into its base object), or null.

public Func<object, object>? Identity { get; set; } #
Fluent("IdentityBy")

The identity of a value for cycle detection (for example the object a host wrapper wraps, since a new wrapper can be created for every read), or null to use the value itself.

public Func<object, IEnumerable<string>>? TypeNames { get; set; } #
Fluent("TypeNamesBy")

Extra type names for a value (for example PowerShell type names), used to find registered shapers, or null.

public CollectionDisplay Collections { get; set; } #

How collections are written inside cells and titles (default CollectionDisplay.Join).

public string Separator { get; set; } #

The separator for CollectionDisplay.Join and CollectionDisplay.FirstN (default ", ").

public int ItemLimit { get; set; } #

How many items a collection shows before the "+N" marker (default 5).

public CultureInfo? Culture { get; set; } #

The culture for numbers and dates, or null for the current culture.

public bool UseReflection { get; set; } #

Whether plain .NET objects may be read through reflection (default true). Callers using trimming must preserve those public members, or set this to false and supply explicit adapters or shapers. Adapter-only mode does not make arbitrary caller delegates or adapters trim-safe.

public int MaxFields { get; set; } #

The most fields a record contributes as default columns (default 12).

public TimeSpan TimeBudget { get; set; } #

How long one shaping pass (a table, a list, a tree) may spend reading values (default 2 seconds).

public int MaxNodes { get; set; } #

How many values one shaping pass may read (default 20 000).

public CultureInfo ResolvedCulture { get; } #

The culture to format with: ShapeOptions.Culture or the current culture.

Extension Methods

public static ShapeOptions Collections(ShapeOptions shapeOptions, CollectionDisplay value) #

Sets ShapeOptions.Collections: How collections are written inside cells and titles (default CollectionDisplay.Join).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value ConsoleMonster.Values.CollectionDisplay required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                              // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { Collections = value };    shapeOptions.Collections(value);
public static ShapeOptions Culture(ShapeOptions shapeOptions, CultureInfo? value) #

Sets ShapeOptions.Culture: The culture for numbers and dates, or null for the current culture.

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value System.Globalization.CultureInfo? required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                          // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { Culture = value };    shapeOptions.Culture(value);
public static ShapeOptions IdentityBy(ShapeOptions shapeOptions, Func<object, object>? value) #

Sets ShapeOptions.Identity: The identity of a value for cycle detection (for example the object a host wrapper wraps, since a new wrapper can be created for every read), or null to use the value itself.

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value System.Func<object, object>? required
The callback.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { Identity = value };    shapeOptions.IdentityBy(value);
public static ShapeOptions ItemLimit(ShapeOptions shapeOptions, int value) #

Sets ShapeOptions.ItemLimit: How many items a collection shows before the "+N" marker (default 5).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value int required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { ItemLimit = value };    shapeOptions.ItemLimit(value);
public static ShapeOptions MaxFields(ShapeOptions shapeOptions, int value) #

Sets ShapeOptions.MaxFields: The most fields a record contributes as default columns (default 12).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value int required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { MaxFields = value };    shapeOptions.MaxFields(value);
public static ShapeOptions MaxNodes(ShapeOptions shapeOptions, int value) #

Sets ShapeOptions.MaxNodes: How many values one shaping pass may read (default 20 000).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value int required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { MaxNodes = value };    shapeOptions.MaxNodes(value);
public static ShapeOptions Separator(ShapeOptions shapeOptions, string value) #

Sets ShapeOptions.Separator: The separator for CollectionDisplay.Join and CollectionDisplay.FirstN (default ", ").

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value string required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { Separator = value };    shapeOptions.Separator(value);
public static ShapeOptions Source(ShapeOptions shapeOptions, IMemberSource item) #

Adds an item to ShapeOptions.Sources: Record adapters tried before the built-in ones (for example PowerShell objects).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
item ConsoleMonster.Data.IMemberSource required
The item.

Returns

ShapeOptions The same instance.
public static ShapeOptions Sources(ShapeOptions shapeOptions, IEnumerable<IMemberSource> items) #

Adds items to ShapeOptions.Sources: Record adapters tried before the built-in ones (for example PowerShell objects).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
items System.Collections.Generic.IEnumerable<ConsoleMonster.Data.IMemberSource> required
The items, in order.

Returns

ShapeOptions The same instance.
public static ShapeOptions TimeBudget(ShapeOptions shapeOptions, TimeSpan value) #

Sets ShapeOptions.TimeBudget: How long one shaping pass (a table, a list, a tree) may spend reading values (default 2 seconds).

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value System.TimeSpan required
The value.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { TimeBudget = value };    shapeOptions.TimeBudget(value);
public static ShapeOptions TypeNamesBy(ShapeOptions shapeOptions, Func<object, IEnumerable<string>>? value) #

Sets ShapeOptions.TypeNames: Extra type names for a value (for example PowerShell type names), used to find registered shapers, or null.

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value System.Func<object, System.Collections.Generic.IEnumerable<string>>? required
The callback.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { TypeNames = value };    shapeOptions.TypeNamesBy(value);
public static ShapeOptions UnwrapBy(ShapeOptions shapeOptions, Func<object, object>? value) #

Sets ShapeOptions.Unwrap: Turns a wrapper into the value it wraps (for example a PowerShell object into its base object), or null.

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value System.Func<object, object>? required
The callback.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { Unwrap = value };    shapeOptions.UnwrapBy(value);
public static ShapeOptions UseReflection(ShapeOptions shapeOptions, bool value = true) #

Sets ShapeOptions.UseReflection: Whether plain .NET objects may be read through reflection (default true). Callers using trimming must preserve those public members, or set this to false and supply explicit adapters or shapers. Adapter-only mode does not make arbitrary caller delegates or adapters trim-safe.

Parameters

shapeOptions ConsoleMonster.Values.ShapeOptions required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ShapeOptions The same instance.

Examples

// C# initializer or property                                                // C# fluent
new global::ConsoleMonster.Values.ShapeOptions { UseReflection = value };    shapeOptions.UseReflection(value);