-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added polyfill for System.Runtime.CompilerServices.OverloadResolution…
…PriorityAttribute type.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...es/Catalog/Gapotchenko.FX/Runtime/CompilerServices/OverloadResolutionPriorityAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#if !NET9_0_OR_GREATER | ||
|
||
#pragma warning disable IDE0130 // Namespace does not match folder structure | ||
|
||
namespace System.Runtime.CompilerServices; | ||
|
||
/// <summary> | ||
/// <para> | ||
/// Specifies the priority of a member in overload resolution. | ||
/// When unspecified, the default priority is <c>0</c>. | ||
/// </para> | ||
/// <para> | ||
/// This is a polyfill provided by Gapotchenko.FX. | ||
/// </para> | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] | ||
public sealed class OverloadResolutionPriorityAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="OverloadResolutionPriorityAttribute"/> class. | ||
/// </summary> | ||
/// <param name="priority"> | ||
/// The priority of the attributed member. | ||
/// Higher numbers are prioritized, lower numbers are deprioritized. | ||
/// <c>0</c> is the default if no attribute is present. | ||
/// </param> | ||
public OverloadResolutionPriorityAttribute(int priority) | ||
{ | ||
Priority = priority; | ||
} | ||
|
||
/// <summary> | ||
/// The priority of the member. | ||
/// </summary> | ||
public int Priority { get; } | ||
} | ||
|
||
#else | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: TypeForwardedTo(typeof(OverloadResolutionPriorityAttribute))] | ||
|
||
#endif |