// 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 { /// Specifies that a type has required members or that a member is required. [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 { /// /// Indicates that compiler support for a particular feature is required for the location where this attribute is applied. /// [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } /// /// The name of the compiler feature. /// public string FeatureName { get; } /// /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand . /// public bool IsOptional { get; init; } /// /// The used for the ref structs C# feature. /// public const string RefStructs = nameof(RefStructs); /// /// The used for the required members C# feature. /// 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 { /// /// Specifies that this constructor sets all required members for the current type, and callers /// do not need to set any required members themselves. /// [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] internal sealed class SetsRequiredMembersAttribute : Attribute { } } #endif