WordCasingOptions Class
Definition
Supplies acronym, minor-word, and culture configuration for the acronym-aware casing converters on StringExtensions.
public sealed class WordCasingOptions
- Inheritance
-
WordCasingOptions
- Inherited Members
- Extension Methods
Remarks
Instances are immutable once constructed: every property is init-only. Construct a customised instance with
an object initialiser, or use Default for the standard configuration.
The same options object is consumed by every rich casing overload - ToCamelCase(string, WordCasingOptions), ToPascalCase(string, WordCasingOptions), ToSnakeCase(string, WordCasingOptions), ToKebabCase(string, WordCasingOptions), ToTrainCase(string, WordCasingOptions), ToConstantCase(string, WordCasingOptions), ToDotCase(string, WordCasingOptions), ToTitleCase(string, WordCasingOptions), and ToSentenceCase(string, WordCasingOptions) - so a single configuration can drive an entire formatting pipeline consistently.
Constructors
WordCasingOptions()
public WordCasingOptions()
Properties
Acronyms
Gets the known acronyms recognised during tokenisation and casing.
public IReadOnlyCollection<string> Acronyms { get; init; }
Property Value
- IReadOnlyCollection<string>
Defaults to a built-in list of 38 common technology acronyms. Supply a custom collection to extend or replace the catalogue.
Culture
Gets the culture used for all case conversions.
public CultureInfo Culture { get; init; }
Property Value
- CultureInfo
Defaults to InvariantCulture. Supply a specific culture (for example
tr-TR) when locale-sensitive casing is required.
Default
Gets a shared WordCasingOptions instance whose every property holds its default value.
public static WordCasingOptions Default { get; }
Property Value
- WordCasingOptions
An immutable, reusable options object suitable as the implicit default for every overload.
LowerCaseMinorWords
Gets a value indicating whether interior minor words are down-cased in title case.
public bool LowerCaseMinorWords { get; init; }
Property Value
- bool
Defaults to false. Affects only ToTitleCase(string, WordCasingOptions).
MinorWords
Gets the minor (connective) words eligible for down-casing in title case.
public IReadOnlyCollection<string> MinorWords { get; init; }
Property Value
- IReadOnlyCollection<string>
Defaults to a built-in list of 21 English connective words. Only consulted when LowerCaseMinorWords is true.
PreserveAcronyms
Gets a value indicating whether all-uppercase tokens and known acronyms keep their acronym spelling in the converters that consult this flag.
public bool PreserveAcronyms { get; init; }
Property Value
Remarks
Only ToTitleCase(string, WordCasingOptions) and ToSentenceCase(string, WordCasingOptions) read this flag. The tokeniser used by the other case converters (camel, Pascal, snake, kebab, train, constant, dot) canonicalises tokens that match a Acronyms entry unconditionally, so those converters render known acronyms in their catalogue spelling regardless of this setting.
PreserveMixedCaseWords
Gets a value indicating whether mixed-case tokens such as OAuth, iPhone, and eBay survive
casing changes verbatim.
public bool PreserveMixedCaseWords { get; init; }
Property Value
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |