| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | // Copied from https://github.com/aspnet/Extensions/tree/master/src/Primitives/src/Extensions.cs |
| | | 5 | | |
| | | 6 | | using System; |
| | | 7 | | using System.Text; |
| | | 8 | | |
| | | 9 | | namespace Azure.Core.Http.Multipart |
| | | 10 | | { |
| | | 11 | | internal static class PrimitiveExtensions |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Add the given <see cref="StringSegment"/> to the <see cref="StringBuilder"/>. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="builder">The <see cref="StringBuilder"/> to add to.</param> |
| | | 17 | | /// <param name="segment">The <see cref="StringSegment"/> to add.</param> |
| | | 18 | | /// <returns>The original <see cref="StringBuilder"/>.</returns> |
| | | 19 | | public static StringBuilder Append(this StringBuilder builder, StringSegment segment) |
| | | 20 | | { |
| | 0 | 21 | | return builder.Append(segment.Buffer, segment.Offset, segment.Length); |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public static StringBuilder Append(this StringBuilder builder, ReadOnlySpan<char> span) |
| | | 25 | | { |
| | | 26 | | // Quick and dirty hack to work around missing extension |
| | 0 | 27 | | return builder.Append(span.ToString()); |
| | | 28 | | } |
| | | 29 | | } |
| | | 30 | | } |