| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ListFormattingOptions.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | namespace MyNet.Humanizer.Formatting.Collections; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Options for list formatting. |
| | | 11 | | /// </summary> |
| | | 12 | | public sealed class ListFormattingOptions |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Gets the default list formatting options. |
| | | 16 | | /// </summary> |
| | 3 | 17 | | public static ListFormattingOptions Default { get; } = new(); |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Gets the separator to use between items in the list. The default is an empty string, which means that items will |
| | | 21 | | /// </summary> |
| | | 22 | | public string Separator { get; init; } = ", "; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets a value indicating whether to use the Oxford comma. |
| | | 26 | | /// </summary> |
| | | 27 | | public bool UseOxfordComma { get; init; } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Gets a value indicating whether to trim items in the list. If true, leading and trailing whitespace will be remo |
| | | 31 | | /// </summary> |
| | | 32 | | public bool TrimItems { get; init; } = true; |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets a value indicating whether to ignore null or whitespace items in the list. If true, any items that are null |
| | | 36 | | /// </summary> |
| | | 37 | | public bool IgnoreNullOrWhiteSpace { get; init; } = true; |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets the conjunction to use when formatting the list. |
| | | 41 | | /// </summary> |
| | | 42 | | public ListConjunction Conjunction { get; init; } = ListConjunction.And; |
| | | 43 | | } |
| | | 44 | | |