ObjectFormattingOptions Class
Definition
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
| Name | Description |
|---|---|
| ObjectFormattingOptions() | Initializes a new instance of the ObjectFormattingOptions class. |
Properties
| Name | Description |
|---|---|
| DescriptorContext | Gets or sets the type specific format context. |