mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
// https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace System.Runtime.CompilerServices
|
|
{
|
|
internal static class IsExternalInit
|
|
{
|
|
}
|
|
|
|
/// <summary>Specifies that a type has required members or that a member is required.</summary>
|
|
[AttributeUsage(
|
|
AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property,
|
|
AllowMultiple = false, Inherited = false)]
|
|
internal sealed class RequiredMemberAttribute : Attribute
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
|
internal sealed class CompilerFeatureRequiredAttribute : Attribute
|
|
{
|
|
public CompilerFeatureRequiredAttribute(string featureName)
|
|
{
|
|
FeatureName = featureName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The name of the compiler feature.
|
|
/// </summary>
|
|
public string FeatureName { get; }
|
|
|
|
/// <summary>
|
|
/// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
|
|
/// </summary>
|
|
public bool IsOptional { get; init; }
|
|
|
|
/// <summary>
|
|
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
|
|
/// </summary>
|
|
public const string RefStructs = nameof(RefStructs);
|
|
|
|
/// <summary>
|
|
/// The <see cref="FeatureName"/> used for the required members C# feature.
|
|
/// </summary>
|
|
public const string RequiredMembers = nameof(RequiredMembers);
|
|
}
|
|
}
|
|
|
|
namespace System.Diagnostics.CodeAnalysis
|
|
{
|
|
/// <summary>
|
|
/// Specifies that this constructor sets all required members for the current type, and callers
|
|
/// do not need to set any required members themselves.
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
|
|
internal sealed class SetsRequiredMembersAttribute : Attribute
|
|
{
|
|
}
|
|
} |