Table of Contents

Class ObjectPortrayalOptions

Namespace
Cuemon
Assembly
Cuemon.Core.dll
public sealed class ObjectPortrayalOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
Inheritance
ObjectPortrayalOptions
Implements
Inherited Members

Constructors

ObjectPortrayalOptions()

Initializes a new instance of the ObjectPortrayalOptions class.

public ObjectPortrayalOptions()

Remarks

 The following table shows the initial property values for an instance of <xref href="Cuemon.ObjectPortrayalOptions" data-throw-if-not-resolved="false"></xref>.

 <table><thead><tr><th class="term">Property</th><th class="description">Initial Value</th></tr></thead><tbody><tr><td class="term"><xref href="Cuemon.ObjectPortrayalOptions.BypassOverrideCheck" data-throw-if-not-resolved="false"></xref></td><td class="description"><code>false</code></td></tr><tr><td class="term"><xref href="Cuemon.ObjectPortrayalOptions.NullValue" data-throw-if-not-resolved="false"></xref></td><td class="description"><code><null></code></td></tr><tr><td class="term"><xref href="Cuemon.ObjectPortrayalOptions.NoGetterValue" data-throw-if-not-resolved="false"></xref></td><td class="description"><code><no getter></code></td></tr><tr><td class="term"><xref href="Cuemon.FormattingOptions.FormatProvider" data-throw-if-not-resolved="false"></xref></td><td class="description"><xref href="System.Globalization.CultureInfo.InvariantCulture" data-throw-if-not-resolved="false"></xref></td></tr><tr><td class="term"><xref href="Cuemon.ObjectPortrayalOptions.Delimiter" data-throw-if-not-resolved="false"></xref></td><td class="description"><code>,</code></td></tr><tr><td class="term"><xref href="Cuemon.ObjectPortrayalOptions.PropertyConverter" data-throw-if-not-resolved="false"></xref></td><td class="description"><pre><code class="lang-csharp">(property, instance, provider) =>

{ if (property.CanRead) { if (TypeUtility.IsComplex(property.PropertyType)) { return string.Format(provider, "{0}={1}", property.Name, ConvertFactory.UseConverter<TypeRepresentationConverter>().ChangeType(property.PropertyType, o => o.FullName = true)); } var instanceValue = ReflectionUtility.GetPropertyValue(instance, property); return string.Format(provider, "{0}={1}", property.Name, instanceValue ?? NullValue); } return string.Format(provider, "{0}={1}", property.Name, NoGetterValue); };PropertiesPredicateproperty => property.PropertyType.IsPublic && property.GetIndexParameters().Length == 0

Properties

BypassOverrideCheck

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

public bool BypassOverrideCheck { get; set; }

Property Value

bool

true to bypass the check that evaluates if a ToString() method is overriden; otherwise, false.

Remarks

If ObjectPortrayal(object, Action<ObjectPortrayalOptions>) is called from within an overriden ToString() method, this property should have a value of true to avoid StackOverflowException.

Delimiter

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

public string Delimiter { get; set; }

Property Value

string

The delimiter specification that is used together with PropertyConverter.

NoGetterValue

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

public string NoGetterValue { get; set; }

Property Value

string

The string representation of a missing getter method of a property.

NullValue

Gets or sets the string representation of a null value.

public string NullValue { get; set; }

Property Value

string

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.

public Func<PropertyInfo, bool> PropertiesPredicate { get; set; }

Property Value

Func<PropertyInfo, bool>

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.

public Func<PropertyInfo, object, IFormatProvider, string> PropertyConverter { get; set; }

Property Value

Func<PropertyInfo, object, IFormatProvider, string>

The function delegate that convert a PropertyInfo object into a human-readable string.

Methods

ValidateOptions()

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

public override void ValidateOptions()

Remarks

This method is expected to throw exceptions when one or more conditions fails to be in a valid state.

See Also