Table of Contents

ObjectPortrayalOptions Class

Definition

Namespace
Cuemon
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/ObjectPortrayalOptions.cs
public sealed class ObjectPortrayalOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
Inheritance
object
ObjectPortrayalOptions
Implements
Inherited Members

Examples

The following example demonstrates how to use with to produce a human-readable property dump of an object.

using System;
using Cuemon;

namespace Contoso.Diagnostics;

public sealed class ObjectPortrayalOptionsExample
{
    public static void Run()
    {
        var options = new ObjectPortrayalOptions
        {
            BypassOverrideCheck = true,
            Delimiter = "; ",
            NullValue = "(none)"
        };

        var profile = new SampleProfile { Name = "Alice", Nickname = null };

        string portrayal = Generate.ObjectPortrayal(profile, setup =>
        {
            setup.BypassOverrideCheck = options.BypassOverrideCheck;
            setup.Delimiter = options.Delimiter;
            setup.NullValue = options.NullValue;
        });

        Console.WriteLine(portrayal);
    }

    private sealed class SampleProfile
    {
        public string Name { get; set; }

        public string Nickname { get; set; }
    }
}

Constructors

Name Description
ObjectPortrayalOptions()

Initializes a new instance of the ObjectPortrayalOptions class.

Properties

Name Description
BypassOverrideCheck

Gets or sets a value indicating whether an overriden method will return without further processing.

Delimiter

Gets or sets the delimiter specification that is used together with PropertyConverter.

NoGetterValue

Gets or sets the string representation of a missing getter method of a property.

NullValue

Gets or sets the string representation of a null value.

PropertiesPredicate

Gets or sets the function delegate that defines a set of criteria and determines whether the specified PropertyInfo meets those criteria.

PropertyConverter

Gets or sets the function delegate that convert a PropertyInfo object into a human-readable string.

Methods

Name Description
ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

See Also