PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.Stringifier Class Reference

Provides convenience functions to get reasonable string representations of objects and collections. More...

Static Public Member Functions

static string StringifyCollection< T > (this IEnumerable< T > objs)
 Provides a reasonable human-readable string representation of a collection.
 
static string Stringify (this object obj)
 Provides a reasonable human-readable string representation of an object.
 
static void Dump (this object obj)
 make-shift drop-in for LINQPad's .Dump(), to use, eg, from csharprepl
 
static string Stringify (object obj, string nullRepresentation)
 Provides a reasonable human-readable string representation of an object.
 

Static Public Attributes

const string DEFAULT_NULL_PLACEHOLDER = "null"
 The default value put into a stringified result when null is encountered.
 
const string SEEN_OBJECT_PLACEHOLDER = "(at:"
 The placeholder put into a stringified result when a circular reference is encountered.
 
const int MAX_STRINGIFY_DEPTH = 10
 your output will contain "...truncated" The max depth the stringifier will go to; after this,
 
const int MAX_OBJECTS = 32
 Limits breadth and path length, not the total: a collection shows at most this many items (the rest are truncated), and rendering does not descend once this many objects are on the current path. Because each branch counts for itself, many branches can together render far more than this: see MAX_TOTAL_OBJECTS for the limit across the whole call.
 
const int MAX_TOTAL_OBJECTS = 200
 Abort stringifying after rendering this many non-primitive objects in total, across the whole call.
 
const int MAX_STRING_LENGTH = 128
 Strings longer than this are truncated in the output.
 
const int MAX_STRINGIFY_MILLISECONDS = 1000
 Stringifying is abandoned (with what has been rendered so far kept) once it has run for this long.
 

Detailed Description

Provides convenience functions to get reasonable string representations of objects and collections.

Member Function Documentation

◆ Dump()

static void PeanutButter.Utils.Stringifier.Dump ( this object  obj)
static

make-shift drop-in for LINQPad's .Dump(), to use, eg, from csharprepl

Parameters
obj

◆ Stringify() [1/2]

static string PeanutButter.Utils.Stringifier.Stringify ( object  obj,
string  nullRepresentation 
)
static

Provides a reasonable human-readable string representation of an object.

Parameters
obj
nullRepresentationHow to represent null values - defaults to the string "null"
Returns
Human-readable representation of object

◆ Stringify() [2/2]

static string PeanutButter.Utils.Stringifier.Stringify ( this object  obj)
static

Provides a reasonable human-readable string representation of an object.

Parameters
obj
Returns
Human-readable representation of object

◆ StringifyCollection< T >()

static string PeanutButter.Utils.Stringifier.StringifyCollection< T > ( this IEnumerable< T >  objs)
static

Provides a reasonable human-readable string representation of a collection.

Parameters
objs
Returns
Human-readable representation of collection

The documentation for this class was generated from the following file: