-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* copy code for StringSyntaxAttribute from original source * document syntax highlighting * add note on usage of GraphQLHttpClient * add note on response type * fix wording
- Loading branch information
Showing
2 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,72 @@ | ||
#if !NET7_0_OR_GREATER | ||
|
||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable once CheckNamespace | ||
namespace System.Diagnostics.CodeAnalysis; | ||
|
||
/// <summary> | ||
/// Stub | ||
/// </summary> | ||
/// <summary>Stub version of the StringSyntaxAttribute, which was introduced in .NET 7</summary> | ||
public sealed class StringSyntaxAttribute : Attribute | ||
{ | ||
// ReSharper disable once InconsistentNaming | ||
/// <summary>Initializes the <see cref="StringSyntaxAttribute"/> with the identifier of the syntax used.</summary> | ||
/// <param name="syntax">The syntax identifier.</param> | ||
public StringSyntaxAttribute(string syntax) | ||
{ | ||
Syntax = syntax; | ||
Arguments = Array.Empty<object?>(); | ||
} | ||
|
||
/// <summary>Initializes the <see cref="StringSyntaxAttribute"/> with the identifier of the syntax used.</summary> | ||
/// <param name="syntax">The syntax identifier.</param> | ||
/// <param name="arguments">Optional arguments associated with the specific syntax employed.</param> | ||
public StringSyntaxAttribute(string syntax, params object?[] arguments) | ||
{ | ||
Syntax = syntax; | ||
Arguments = arguments; | ||
} | ||
|
||
/// <summary>Gets the identifier of the syntax used.</summary> | ||
public string Syntax { get; } | ||
|
||
/// <summary>Optional arguments associated with the specific syntax employed.</summary> | ||
public object?[] Arguments { get; } | ||
|
||
/// <summary>The syntax identifier for strings containing composite formats for string formatting.</summary> | ||
#pragma warning disable IDE1006 | ||
public const string CompositeFormat = nameof(CompositeFormat); | ||
#pragma warning restore IDE1006 | ||
|
||
#pragma warning disable IDE0060 | ||
public StringSyntaxAttribute(string syntax) | ||
{ } | ||
#pragma warning restore IDE0060 | ||
/// <summary>The syntax identifier for strings containing date format specifiers.</summary> | ||
public const string DateOnlyFormat = nameof(DateOnlyFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing date and time format specifiers.</summary> | ||
public const string DateTimeFormat = nameof(DateTimeFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing <see cref="Enum"/> format specifiers.</summary> | ||
public const string EnumFormat = nameof(EnumFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing <see cref="Guid"/> format specifiers.</summary> | ||
public const string GuidFormat = nameof(GuidFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing JavaScript Object Notation (JSON).</summary> | ||
public const string Json = nameof(Json); | ||
|
||
/// <summary>The syntax identifier for strings containing numeric format specifiers.</summary> | ||
public const string NumericFormat = nameof(NumericFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing regular expressions.</summary> | ||
public const string Regex = nameof(Regex); | ||
|
||
/// <summary>The syntax identifier for strings containing time format specifiers.</summary> | ||
public const string TimeOnlyFormat = nameof(TimeOnlyFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing <see cref="TimeSpan"/> format specifiers.</summary> | ||
public const string TimeSpanFormat = nameof(TimeSpanFormat); | ||
|
||
/// <summary>The syntax identifier for strings containing URIs.</summary> | ||
public const string Uri = nameof(Uri); | ||
|
||
/// <summary>The syntax identifier for strings containing XML.</summary> | ||
public const string Xml = nameof(Xml); | ||
#pragma warning restore IDE1006 | ||
} | ||
|
||
#endif |