Table of Contents

Class FormattingOptions

Namespace
Cuemon
Assembly
Cuemon.Core.dll

Configuration options for IFormatProvider.

public class FormattingOptions : IValidatableParameterObject, IParameterObject
Inheritance
FormattingOptions
Implements
Derived

Examples

The following example demonstrates how to configure a with a custom format provider to control numeric formatting.

using System;
using System.Globalization;
using Cuemon;

namespace MyApp.Examples;

public class FormattingOptionsExample
{
    public void Demonstrate()
    {
        var options = new FormattingOptions
        {
            FormatProvider = new CultureInfo("da-DK")
        };

        var value = 1234.56;
        var formatted = value.ToString("N2", options.FormatProvider);

        Console.WriteLine(formatted); // Output depends on the culture (e.g., "1.234,56" for da-DK)

}
}

Constructors

FormattingOptions()

Initializes a new instance of the FormattingOptions class.

public FormattingOptions()

Properties

FormatProvider

Gets or sets the IFormatProvider that provides a mechanism for retrieving an object to control formatting.

public IFormatProvider FormatProvider { get; set; }

Property Value

IFormatProvider

The IFormatProvider that provides a mechanism for retrieving an object to control formatting.

Methods

ValidateOptions()

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

public virtual void ValidateOptions()

Remarks

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

See Also