Class ObjectFormattingOptions
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
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
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
ObjectFormattingOptions()
Initializes a new instance of the ObjectFormattingOptions class.
public ObjectFormattingOptions()
Remarks
The following table shows the initial property values for an instance of ObjectFormattingOptions.
| Property | Initial Value |
|---|---|
| FormatProvider | InvariantCulture |
| DescriptorContext | null |
Properties
DescriptorContext
Gets or sets the type specific format context.
public ITypeDescriptorContext DescriptorContext { get; set; }
Property Value
- ITypeDescriptorContext
The type specific format context.