Table of Contents

ObjectFormattingOptions Class

Definition

Namespace
Cuemon
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/ObjectFormattingOptions.cs

Configuration options for FromObject() and methods of ObjectDecoratorExtensions.

public class ObjectFormattingOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
Inheritance
ObjectFormattingOptions
Implements
Inherited Members

Examples

The following example demonstrates how to use to customize the conversion of an object to a different type via .

using System;
using System.Globalization;
using Cuemon;

namespace MyApp.Examples;

public class ObjectFormattingOptionsExample
{
    public void Demonstrate()
    {
        // Direct instantiation of ObjectFormattingOptions
        var options = new ObjectFormattingOptions
        {
            FormatProvider = new CultureInfo("da-DK")
        };

        var value = "1234.56";

        // Convert the string to a double using Danish formatting
        var result = Decorator.Enclose((object)value)
            .ChangeType<double>(o =>
            {
                o.FormatProvider = new CultureInfo("da-DK");
            });

        Console.WriteLine(result); // Output: 1234.56

}
}

Constructors

Name Description
ObjectFormattingOptions()

Initializes a new instance of the ObjectFormattingOptions class.

Properties

Name Description
DescriptorContext

Gets or sets the type specific format context.