SlugOptions Class
Definition
Supplies separator, casing, diacritic, and length configuration for ToSlug(string, SlugOptions).
public sealed class SlugOptions
- Inheritance
-
SlugOptions
- 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.
Constructors
SlugOptions()
public SlugOptions()
Properties
Default
Gets a shared SlugOptions instance whose every property holds its default value.
public static SlugOptions Default { get; }
Property Value
- SlugOptions
An immutable, reusable options object suitable as the implicit default for slug generation.
Lowercase
Gets a value indicating whether the slug is lower-cased.
public bool Lowercase { get; init; }
Property Value
MaxLength
Gets the maximum slug length, or zero for an unbounded slug.
public int MaxLength { get; init; }
Property Value
- int
Defaults to
0(unlimited). When greater than zero, the slug is truncated at a separator boundary so the result never exceeds the limit and never ends with a dangling separator.
NormalizeDiacritics
Gets a value indicating whether diacritical marks are stripped and transliterated before slugging.
public bool NormalizeDiacritics { get; init; }
Property Value
Separator
Gets the character inserted between adjacent words in the slug.
public char Separator { get; init; }
Property Value
- char
Defaults to the hyphen
'-'.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |