Skip to content

Commit

Permalink
Added polyfill for System.Runtime.CompilerServices.OverloadResolution…
Browse files Browse the repository at this point in the history
…PriorityAttribute type.
  • Loading branch information
hrumhurum committed Dec 31, 2024
1 parent f270e6d commit cb48378
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release date: not released yet
- Added `Gapotchenko.FX.IOptional` interface for `Gapotchenko.FX.Optional<T>` type to allow an untyped value introspection
- Implemented memory span-based operations for `Gapotchenko.FX.IO.FragmentedMemoryStream`
- Polyfills:
- Added polyfill for `System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute` type
- Added `Zip(first, second)` and `Zip(first, second, third)` polyfill methods for `IEnumerable<T>` type
- Fixed issues:
- Fixed issue with nested `Gapotchenko.FX.Optional<T>` values that could occur during implicit value conversion
Expand Down
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

0 comments on commit cb48378

Please sign in to comment.