#if !NET8_0_OR_GREATER
#nullable enable
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics.CodeAnalysis
{
///
/// Indicates that an API is experimental and it may change in the future.
///
///
/// This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental
/// feature is used. Authors can use this attribute to ship preview features in their assemblies.
///
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Module |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Enum |
AttributeTargets.Constructor |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Event |
AttributeTargets.Interface |
AttributeTargets.Delegate, Inherited = false)]
internal sealed class ExperimentalAttribute : Attribute
{
///
/// Initializes a new instance of the class, specifying the ID that the compiler will use
/// when reporting a use of the API the attribute applies to.
///
/// The ID that the compiler will use when reporting a use of the API the attribute applies to.
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
///
/// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to.
///
/// The unique diagnostic ID.
///
/// The diagnostic ID is shown in build output for warnings and errors.
/// This property represents the unique ID that can be used to suppress the warnings or errors, if needed.
///
public string DiagnosticId { get; }
///
/// Gets or sets the URL for corresponding documentation.
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
///
/// The format string that represents a URL to corresponding documentation.
/// An example format string is https://contoso.com/obsoletion-warnings/{0}.
public string? UrlFormat { get; set; }
}
}
#endif // !NET8_0_OR_LATER