FormattingOptions Class
Definition
Configuration options for IFormatProvider.
public class FormattingOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
objectFormattingOptions
- Implements
- Derived
Examples
The following example demonstrates how to configure a
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
| Name | Description |
|---|---|
| FormattingOptions() | Initializes a new instance of the FormattingOptions class. |
Properties
| Name | Description |
|---|---|
| FormatProvider | Gets or sets the IFormatProvider that provides a mechanism for retrieving an object to control formatting. |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |