ObjectPortrayalOptions Class
Definition
Configuration options for ObjectPortrayal(object, Action<ObjectPortrayalOptions>).
public sealed class ObjectPortrayalOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
- Inheritance
-
objectObjectPortrayalOptions
- Implements
- Inherited Members
Examples
The following example demonstrates how to use
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 |
| NullValue | Gets or sets the string representation of a |
| 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. |