Class EnumStringOptions
Configuration options for concrete implementations of IConfigurableParser<TOptions> that is related to parsing an Enum from a string.
public class EnumStringOptions : IParameterObject
- Inheritance
-
EnumStringOptions
- Implements
Examples
The following example demonstrates how to configure EnumStringOptions to control case sensitivity when parsing an enum from a string using ParserFactory.FromEnum.
using System;
using Cuemon;
using Cuemon.Text;
namespace MyApp.Examples;
public class EnumStringOptionsExample
{
public void Demonstrate()
{
// Direct instantiation of EnumStringOptions
var options = new EnumStringOptions
{
IgnoreCase = true
};
var parser = ParserFactory.FromEnum();
var result = (UriKind)parser.Parse("Relative", typeof(UriKind), o =>
{
o.IgnoreCase = true;
});
Console.WriteLine(result); // outputs: Relative
}
}
Constructors
EnumStringOptions()
Initializes a new instance of the EnumStringOptions class.
public EnumStringOptions()
Remarks
The following table shows the initial property values for an instance of EnumStringOptions.
| Property | Initial Value |
|---|---|
| IgnoreCase | true |
Properties
IgnoreCase
Gets or sets a value indicating whether to ignore or regard the case of the string being parsed.
public bool IgnoreCase { get; set; }
Property Value
- bool
trueto ignore the case of the string being parsed; otherwise,false.