|
3 | 3 | using System.Buffers.Text;
|
4 | 4 | using System.Text;
|
5 | 5 |
|
| 6 | +#if !NET6_0_OR_GREATER |
| 7 | +namespace System.Runtime.CompilerServices |
| 8 | +{ |
| 9 | + /// <summary> |
| 10 | + /// Indicates the attributed type is to be used as an interpolated string handler. |
| 11 | + /// </summary> |
| 12 | + [global::System.AttributeUsage( |
| 13 | + global::System.AttributeTargets.Class | |
| 14 | + global::System.AttributeTargets.Struct, |
| 15 | + AllowMultiple = false, Inherited = false)] |
| 16 | + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] |
| 17 | + internal sealed class InterpolatedStringHandlerAttribute : global::System.Attribute |
| 18 | + { |
| 19 | + } |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// Indicates which arguments to a method involving an interpolated string handler should be passed to that handler. |
| 23 | + /// </summary> |
| 24 | + [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] |
| 25 | + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] |
| 26 | + internal sealed class InterpolatedStringHandlerArgumentAttribute : global::System.Attribute |
| 27 | + { |
| 28 | + /// <summary> |
| 29 | + /// Initializes a new instance of the <see cref="global::System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute"/> class. |
| 30 | + /// </summary> |
| 31 | + /// <param name="argument">The name of the argument that should be passed to the handler.</param> |
| 32 | + /// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> |
| 33 | + public InterpolatedStringHandlerArgumentAttribute(string argument) |
| 34 | + { |
| 35 | + Arguments = new string[] { argument }; |
| 36 | + } |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Initializes a new instance of the <see cref="global::System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute"/> class. |
| 40 | + /// </summary> |
| 41 | + /// <param name="arguments">The names of the arguments that should be passed to the handler.</param> |
| 42 | + /// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> |
| 43 | + public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) |
| 44 | + { |
| 45 | + Arguments = arguments; |
| 46 | + } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Gets the names of the arguments that should be passed to the handler. |
| 50 | + /// </summary> |
| 51 | + /// <remarks><see langword="null"/> may be used as the name of the receiver in an instance method.</remarks> |
| 52 | + public string[] Arguments { get; } |
| 53 | + } |
| 54 | +} |
| 55 | +#endif |
| 56 | + |
6 | 57 | namespace Utf8StringInterpolation
|
7 | 58 | {
|
8 | 59 | internal static partial class Shims
|
|
0 commit comments