mirror of
https://github.com/aphrody-labs/NuGet.Client.git
synced 2026-10-14 05:19:04 +00:00
76 lines
3.3 KiB
C#
76 lines
3.3 KiB
C#
// Copied from https://raw.githubusercontent.com/dotnet/runtime/09e796af2adb5e2b821a4fc19fd9903700b771d3/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RequiredMemberAttribute.cs
|
|
// Copied from https://raw.githubusercontent.com/dotnet/runtime/09e796af2adb5e2b821a4fc19fd9903700b771d3/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CompilerFeatureRequiredAttribute.cs
|
|
// Copied from https://raw.githubusercontent.com/dotnet/runtime/09e796af2adb5e2b821a4fc19fd9903700b771d3/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/SetsRequiredMembersAttribute.cs
|
|
// Modified to work in the NuGet.Client repo
|
|
|
|
// Used to enable the `required` modifier in TargetFrameworks before .NET 7
|
|
|
|
#if !NET7_0_OR_GREATER
|
|
|
|
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using System.ComponentModel;
|
|
|
|
namespace System.Runtime.CompilerServices
|
|
{
|
|
/// <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)]
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
internal sealed class RequiredMemberAttribute : Attribute
|
|
{ }
|
|
}
|
|
|
|
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
namespace System.Runtime.CompilerServices
|
|
{
|
|
/// <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);
|
|
}
|
|
}
|
|
|
|
// 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
|
|
{
|
|
/// <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
|
|
{ }
|
|
}
|
|
#endif
|