| | 1 | | namespace MoreStructures.Utilities; |
| | 2 | |
|
| | 3 | | /// <summary> |
| | 4 | | /// A <see cref="IValueEnumerable{T}"/> implementation, wrapping a <see cref="string"/>. |
| | 5 | | /// </summary> |
| | 6 | | /// <remarks> |
| | 7 | | /// Useful when a <see cref="string"/> property/field should be equatable to an <see cref="IEnumerable{T}"/> by value. |
| | 8 | | /// <br/> |
| | 9 | | /// For example, when a property or field is declared as <see cref="IEnumerable{T}"/> of <see cref="char"/>, and can be |
| | 10 | | /// assigned either a <see cref="string"/> or a generic <see cref="IEnumerable{T}"/>, and it has to be solely compared |
| | 11 | | /// by value (i.e. on the actual chars in the <see cref="string"/> and <see cref="IEnumerable{T}"/>). |
| | 12 | | /// </remarks> |
| | 13 | | public class StringValueEnumerable : ValueEnumerable<char> |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// Builds a <see cref="ValueEnumerable{T}"/> around the provided <paramref name="stringValue"/>. |
| | 17 | | /// </summary> |
| | 18 | | /// <param name="stringValue">The string to wrap.</param> |
| | 19 | | /// <remarks> |
| | 20 | | /// Time and Space Complexity are O(1), as this constructor doesn't iterate over <paramref name="stringValue"/>. |
| | 21 | | /// </remarks> |
| 4335 | 22 | | public StringValueEnumerable(string stringValue) : base(stringValue) |
| 4335 | 23 | | { |
| 4335 | 24 | | StringValue = stringValue; |
| 4335 | 25 | | } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// The <see cref="string"/> value underlying this <see cref="IValueEnumerable{T}"/>. |
| | 29 | | /// </summary> |
| 33488 | 30 | | public string StringValue { get; } |
| | 31 | | } |