openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
OpenAI/src/Utility/Polyfill/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs
60lines · modecode
| 1 | #if !NET8_0_OR_GREATER |
| 2 | #nullable enable |
| 3 | |
| 4 | // Licensed to the .NET Foundation under one or more agreements. |
| 5 | // The .NET Foundation licenses this file to you under the MIT license. |
| 6 | |
| 7 | namespace System.Diagnostics.CodeAnalysis |
| 8 | { |
| 9 | /// <summary> |
| 10 | /// Indicates that an API is experimental and it may change in the future. |
| 11 | /// </summary> |
| 12 | /// <remarks> |
| 13 | /// This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental |
| 14 | /// feature is used. Authors can use this attribute to ship preview features in their assemblies. |
| 15 | /// </remarks> |
| 16 | [AttributeUsage(AttributeTargets.Assembly | |
| 17 | AttributeTargets.Module | |
| 18 | AttributeTargets.Class | |
| 19 | AttributeTargets.Struct | |
| 20 | AttributeTargets.Enum | |
| 21 | AttributeTargets.Constructor | |
| 22 | AttributeTargets.Method | |
| 23 | AttributeTargets.Property | |
| 24 | AttributeTargets.Field | |
| 25 | AttributeTargets.Event | |
| 26 | AttributeTargets.Interface | |
| 27 | AttributeTargets.Delegate, Inherited = false)] |
| 28 | internal sealed class ExperimentalAttribute : Attribute |
| 29 | { |
| 30 | /// <summary> |
| 31 | /// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class, specifying the ID that the compiler will use |
| 32 | /// when reporting a use of the API the attribute applies to. |
| 33 | /// </summary> |
| 34 | /// <param name="diagnosticId">The ID that the compiler will use when reporting a use of the API the attribute applies to.</param> |
| 35 | public ExperimentalAttribute(string diagnosticId) |
| 36 | { |
| 37 | DiagnosticId = diagnosticId; |
| 38 | } |
| 39 | |
| 40 | /// <summary> |
| 41 | /// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to. |
| 42 | /// </summary> |
| 43 | /// <value>The unique diagnostic ID.</value> |
| 44 | /// <remarks> |
| 45 | /// The diagnostic ID is shown in build output for warnings and errors. |
| 46 | /// <para>This property represents the unique ID that can be used to suppress the warnings or errors, if needed.</para> |
| 47 | /// </remarks> |
| 48 | public string DiagnosticId { get; } |
| 49 | |
| 50 | /// <summary> |
| 51 | /// Gets or sets the URL for corresponding documentation. |
| 52 | /// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID. |
| 53 | /// </summary> |
| 54 | /// <value>The format string that represents a URL to corresponding documentation.</value> |
| 55 | /// <remarks>An example format string is <c>https://contoso.com/obsoletion-warnings/{0}</c>.</remarks> |
| 56 | public string? UrlFormat { get; set; } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | #endif // !NET8_0_OR_LATER |