SimonCropp/Polyfill

Source only package that exposes newer APIs, .net features, and C# features to older runtimes.

487

stars

2,083

commits

C#

primary language

Sep 10, 2026

updated

README

Polyfill

Build status Polyfill NuGet Status

Source only package that exposes newer .NET and C# features to older runtimes.

The package targets netstandard2.0 and is designed to support the following runtimes.

  • net461, net462, net47, net471, net472, net48, net481
  • netcoreapp2.0, netcoreapp2.1, netcoreapp3.0, netcoreapp3.1
  • net5.0, net6.0, net7.0, net8.0, net9.0, net10.0, net11.0
  • uap10

API count: 1031

Per Target Framework

TargetAPIs
net461972
net462972
net47971
net471970
net472966
net48966
net481966
netstandard2.0968
netstandard2.1821
netcoreapp2.0891
netcoreapp2.1832
netcoreapp2.2832
netcoreapp3.0779
netcoreapp3.1778
net5.0650
net6.0555
net7.0402
net8.0283
net9.0189
net10.0135
net11.058
uap10.0958

See Milestones for release notes.

Powered by

JetBrains logo.

Nuget

TargetFrameworks

It is recommended that projects that consume Polyfill multi-target all TFMs that the project is expected to be consumed in. See Polyfill and TargetFrameworks

SDK / LangVersion

This project uses features from the newest stable SDK and C# language. As such consuming projects should target those:

LangVersion

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <LangVersion>latest</LangVersion>

global.json

{
  "sdk": {
    "version": "10.0.300",
    "rollForward": "latestFeature"
  }
}

Assembly size impact

Assembly Sizes

Empty AssemblyWith PolyfillDiffEnsureArgumentExceptionsStringInterpolationNullability
netstandard2.08.0KB358.5KB+350.5KB+7.5KB+6.5KB+7.5KB+12.0KB
netstandard2.18.5KB312.5KB+304.0KB+9.0KB+6.5KB+9.0KB+13.5KB
net4618.5KB357.0KB+348.5KB+7.5KB+6.5KB+8.0KB+12.5KB
net4627.0KB360.5KB+353.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net477.0KB360.5KB+353.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net4718.5KB359.5KB+351.0KB+7.5KB+6.5KB+7.5KB+12.0KB
net4728.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
net488.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
net4818.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
netcoreapp2.09.0KB336.0KB+327.0KB+8.5KB+6.5KB+9.0KB+13.5KB
netcoreapp2.19.0KB316.0KB+307.0KB+9.0KB+6.5KB+9.0KB+13.5KB
netcoreapp2.29.0KB316.0KB+307.0KB+9.0KB+6.5KB+9.0KB+13.5KB
netcoreapp3.09.5KB308.5KB+299.0KB+9.0KB+6.5KB+9.0KB+14.0KB
netcoreapp3.19.5KB307.0KB+297.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net5.09.5KB271.0KB+261.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net6.010.0KB212.5KB+202.5KB+10.0KB+7.0KB+512bytes+3.5KB
net7.010.0KB175.0KB+165.0KB+11.5KB+8.0KB+512bytes+3.0KB
net8.09.5KB145.5KB+136.0KB+8.5KB+512bytes+3.0KB
net9.09.5KB98.5KB+89.0KB+8.5KB+512bytes+3.5KB
net10.010.0KB76.0KB+66.0KB+8.5KB+512bytes+3.5KB
net11.010.0KB20.5KB+10.5KB+9.0KB+512bytes+3.5KB

Assembly Sizes with EmbedUntrackedSources

Empty AssemblyWith PolyfillDiffEnsureArgumentExceptionsStringInterpolationNullability
netstandard2.08.0KB524.4KB+516.4KB+15.2KB+8.2KB+12.4KB+17.4KB
netstandard2.18.5KB451.8KB+443.3KB+16.7KB+8.2KB+13.9KB+18.9KB
net4618.5KB524.0KB+515.5KB+15.2KB+8.2KB+12.9KB+17.9KB
net4627.0KB527.5KB+520.5KB+16.7KB+8.2KB+13.9KB+18.9KB
net477.0KB527.2KB+520.2KB+16.7KB+8.2KB+13.9KB+18.9KB
net4718.5KB525.8KB+517.3KB+15.2KB+8.2KB+12.4KB+17.4KB
net4728.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
net488.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
net4818.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
netcoreapp2.09.0KB491.3KB+482.3KB+16.2KB+8.2KB+13.9KB+18.9KB
netcoreapp2.19.0KB459.0KB+450.0KB+16.7KB+8.2KB+13.9KB+18.9KB
netcoreapp2.29.0KB459.0KB+450.0KB+16.7KB+8.2KB+13.9KB+18.9KB
netcoreapp3.09.5KB442.7KB+433.2KB+16.7KB+8.2KB+13.9KB+19.4KB
netcoreapp3.19.5KB441.2KB+431.7KB+16.7KB+8.2KB+13.9KB+18.9KB
net5.09.5KB387.0KB+377.5KB+16.7KB+8.2KB+13.9KB+18.9KB
net6.010.0KB308.4KB+298.4KB+17.7KB+8.7KB+1.1KB+4.2KB
net7.010.0KB252.3KB+242.3KB+19.1KB+9.4KB+1.1KB+3.7KB
net8.09.5KB207.3KB+197.8KB+16.0KB+299bytes+1.1KB+3.7KB
net9.09.5KB139.1KB+129.6KB+16.0KB+1.1KB+4.2KB
net10.010.0KB108.0KB+98.0KB+16.0KB+1.1KB+4.2KB
net11.010.0KB30.3KB+20.3KB+16.5KB+1.1KB+4.2KB

PolyfillLib

To consume Polyfill as a library (instead of a source-only package) see PolyfillLib

Troubleshooting

Make sure DefineConstants is not set from dotnet CLI, which would override important constants set by Polyfill.

Instead of using dotnet publish -p:DefineConstants=MY_CONSTANT, set the constant indirectly in the project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <DefineConstants Condition="'$(MyConstant)' == 'true'">$(DefineConstants);MY_CONSTANT</DefineConstants>

and use dotnet publish -p:MyConstant=true.

Included polyfills

ModuleInitializerAttribute

Reference: Module Initializers

static bool InitCalled;

[Test]
public async Task ModuleInitTest() =>
    await Assert.That(InitCalled).IsTrue();

[ModuleInitializer]
public static void ModuleInit() =>
    InitCalled = true;

snippet source | anchor

IsExternalInit

Reference: init (C# Reference)

class InitSample
{
    public int Member { get; init; }
}

snippet source | anchor

Nullable attributes

Reference: Nullable reference types

Required attributes

Reference: C# required modifier

public class Person
{
    public Person()
    {
    }

    [SetsRequiredMembers]
    public Person(string name) =>
        Name = name;

    public required string Name { get; init; }
}

snippet source | anchor

CompilerFeatureRequiredAttribute

Indicates that compiler support for a particular feature is required for the location where this attribute is applied.

CollectionBuilderAttribute

Can be used to make types compatible with collection expressions

ConstantExpectedAttribute

Indicates that the specified method parameter expects a constant.

SkipLocalsInit

Reference: SkipLocalsInitAttribute

the SkipLocalsInit attribute prevents the compiler from setting the .locals init flag when emitting to metadata. The SkipLocalsInit attribute is a single-use attribute and can be applied to a method, a property, a class, a struct, an interface, or a module, but not to an assembly. SkipLocalsInit is an alias for SkipLocalsInitAttribute.

class SkipLocalsInitSample
{
    [SkipLocalsInit]
    static void ReadUninitializedMemory()
    {
        Span<int> numbers = stackalloc int[120];
        for (var i = 0; i < 120; i++)
        {
            Console.WriteLine(numbers[i]);
        }
    }
}

snippet source | anchor

Index and Range

Reference: Indices and ranges

If consuming in a project that targets net461 or net462, a reference to System.ValueTuple is required. See References: System.ValueTuple.

class IndexRangeSample
{
    [Test]
    public async Task Range()
    {
        var substring = "value"[2..];
        await Assert.That(substring).IsEqualTo("lue");
    }

    [Test]
    public async Task Index()
    {
        var ch = "value"[^2];
        await Assert.That(ch).IsEqualTo('u');
    }

    [Test]
    public async Task ArrayIndex()
    {
        var array = new[]
        {
            "value1",
            "value2"
        };

        var value = array[^2];

        await Assert.That(value).IsEqualTo("value1");
    }
}

snippet source | anchor

OverloadResolutionPriority

C# introduces a new attribute, System.Runtime.CompilerServices.OverloadResolutionPriority, that can be used by API authors to adjust the relative priority of overloads within a single type as a means of steering API consumers to use specific APIs, even if those APIs would normally be considered ambiguous or otherwise not be chosen by C#'s overload resolution rules. This helps framework and library authors guide API usage as they APIs as they develop new and better patterns.

The OverloadResolutionPriorityAttribute can be used in conjunction with the ObsoleteAttribute. A library author may mark properties, methods, types and other programming elements as obsolete, while leaving them in place for backwards compatibility. Using programming elements marked with the ObsoleteAttribute will result in compiler warnings or errors. However, the type or member is still visible to overload resolution and may be selected over a better overload or cause an ambiguity failure. The OverloadResolutionPriorityAttribute lets library authors fix these problems by lowering the priority of obsolete members when there are better alternatives.

Usage

public class OverloadResolutionPriorityAttributeTests
{
    [Test]
    public Task Run()
    {
        int[] arr = [1, 2, 3];
        //Prints "Span" because resolution priority is higher
        Method(arr);
        return Task.CompletedTask;
    }

    [OverloadResolutionPriority(2)]
    static void Method(ReadOnlySpan<int> list) =>
        Console.WriteLine("Span");

    [OverloadResolutionPriority(1)]
    static void Method(int[] list) =>
        Console.WriteLine("Array");
}

snippet source | anchor

UnscopedRefAttribute

Reference: Low Level Struct Improvements

struct UnscopedRefUsage
{
    int field1;

    [UnscopedRef] ref int Prop1 => ref field1;
}

snippet source | anchor

RequiresPreviewFeaturesAttribute

CallerArgumentExpressionAttribute

Reference: CallerArgumentExpression

static class FileUtil
{
    public static void FileExists(string path, [CallerArgumentExpression("path")] string name = "")
    {
        if (!File.Exists(path))
        {
            throw new ArgumentException($"File not found. Path: {path}", name);
        }
    }
}

static class FileUtilUsage
{
    public static string[] Method(string path)
    {
        FileUtil.FileExists(path);
        return File.ReadAllLines(path);
    }
}

snippet source | anchor

InterpolatedStringHandler

Enable by adding an MSBuild property PolyStringInterpolation

<PropertyGroup>
  ...
  <PolyStringInterpolation>true</PolyStringInterpolation>
</PropertyGroup>

References: String Interpolation in C# 10 and .NET 6, Write a custom string interpolation handler

[!IMPORTANT] In the below extension method list, the methods using AppendInterpolatedStringHandler parameter are not extensions because the compiler prefers to use the overload with string parameter instead.

StringSyntaxAttribute

Reference: .NET 7 - The StringSyntaxAttribute

Trimming annotation attributes

Reference: Prepare .NET libraries for trimming

Platform compatibility

Reference: Platform compatibility analyzer

StackTraceHiddenAttribute

Reference: C# – Hide a method from the stack trace

UnmanagedCallersOnly

Reference: Improvements in native code interop in .NET 5.0

SuppressGCTransition

DisableRuntimeMarshalling

Extensions

The class Polyfill includes the following extension methods:

Extension methods

ArgumentException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

  • void ThrowIfNullOrEmpty(string?) reference
  • void ThrowIfNullOrWhiteSpace(string?) reference

ArgumentNullException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

ArgumentOutOfRangeException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

  • void ThrowIfEqual<T>(T, T) where T : IEquatable<T>? reference
  • void ThrowIfGreaterThan(nint, nint)
  • void ThrowIfGreaterThan<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfGreaterThanOrEqual(nint, nint)
  • void ThrowIfGreaterThanOrEqual<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfLessThan(nint, nint)
  • void ThrowIfLessThan<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfLessThanOrEqual(nint, nint)
  • void ThrowIfLessThanOrEqual<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfNegative(nint) reference
  • void ThrowIfNegative<T>(T) where T : struct, IComparable<T> reference
  • void ThrowIfNegativeOrZero(nint)
  • void ThrowIfNegativeOrZero<T>(T) where T : struct, IComparable<T> reference
  • void ThrowIfNotEqual<T>(T, T) where T : IEquatable<T>? reference
  • void ThrowIfZero(nint)
  • void ThrowIfZero<T>(T) where T : struct, IEquatable<T> reference

ArraySegment

Base64

  • OperationStatus DecodeFromChars(ReadOnlySpan<char>, Span<byte>, int, int, bool) reference
  • int DecodeFromChars(ReadOnlySpan<char>, Span<byte>) reference
  • byte[] DecodeFromChars(ReadOnlySpan<char>) reference
  • byte[] DecodeFromUtf8(ReadOnlySpan<byte>) reference
  • OperationStatus EncodeToChars(ReadOnlySpan<byte>, Span<char>, int, int, bool) reference
  • int EncodeToChars(ReadOnlySpan<byte>, Span<char>) reference
  • char[] EncodeToChars(ReadOnlySpan<byte>) reference
  • string EncodeToString(ReadOnlySpan<byte>) reference
  • byte[] EncodeToUtf8(ReadOnlySpan<byte>) reference
  • int GetEncodedLength(int) reference
  • int GetMaxDecodedLength(int) reference
  • bool TryDecodeFromChars(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryEncodeToChars(ReadOnlySpan<byte>, Span<char>, int) reference

BinaryPrimitives

  • double ReadDoubleBigEndian(ReadOnlySpan<byte>) reference
  • double ReadDoubleLittleEndian(ReadOnlySpan<byte>) reference
  • float ReadSingleBigEndian(ReadOnlySpan<byte>) reference
  • float ReadSingleLittleEndian(ReadOnlySpan<byte>) reference
  • bool TryReadDoubleBigEndian(ReadOnlySpan<byte>, double) reference
  • bool TryReadDoubleLittleEndian(ReadOnlySpan<byte>, double) reference
  • bool TryReadSingleBigEndian(ReadOnlySpan<byte>, float) reference
  • bool TryReadSingleLittleEndian(ReadOnlySpan<byte>, float) reference
  • bool TryWriteDoubleBigEndian(Span<byte>, double) reference
  • bool TryWriteDoubleLittleEndian(Span<byte>, double) reference
  • bool TryWriteSingleBigEndian(Span<byte>, float) reference
  • bool TryWriteSingleLittleEndian(Span<byte>, float) reference
  • void WriteDoubleBigEndian(Span<byte>, double) reference
  • void WriteDoubleLittleEndian(Span<byte>, double) reference
  • void WriteSingleBigEndian(Span<byte>, float) reference
  • void WriteSingleLittleEndian(Span<byte>, float) reference

Boolean

Byte

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, byte) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<char>, byte) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, byte) reference
  • bool TryParse(string?, IFormatProvider?, byte) reference

CancellationToken

  • CancellationTokenRegistration Register(Action<object?, CancellationToken>, object?) reference
  • CancellationTokenRegistration UnsafeRegister(Action<object?, CancellationToken>, object?) reference
  • CancellationTokenRegistration UnsafeRegister(Action<object?>, object?) reference

CancellationTokenSource

Capture

Char

ConcurrentBag

ConcurrentDictionary<TKey, TValue>

  • TValue GetOrAdd<TKey, TValue, TArg>(TKey, Func<TKey, TArg, TValue>, TArg) where TKey : notnull reference

ConcurrentQueue

ConditionalWeakTable<TKey, TValue>

  • bool Remove<TKey, TValue>(TKey, TValue) where TKey : class where TValue : class reference
    • Note: Lookup and removal are not performed under the table lock, so the operation is not atomic with regard to concurrent mutations.

Console

  • SafeFileHandle OpenStandardErrorHandle() reference
  • SafeFileHandle OpenStandardInputHandle() reference
  • SafeFileHandle OpenStandardOutputHandle() reference

Convert

  • OperationStatus FromHexString(ReadOnlySpan<byte>, Span<byte>, int, int) reference
  • byte[] FromHexString(ReadOnlySpan<byte>) reference
  • OperationStatus FromHexString(ReadOnlySpan<char>, Span<byte>, int, int) reference
  • byte[] FromHexString(ReadOnlySpan<char>) reference
  • OperationStatus FromHexString(string, Span<byte>, int, int) reference
  • byte[] FromHexString(string) reference
  • string ToHexString(byte[], int, int) reference
  • string ToHexString(byte[]) reference
  • string ToHexString(ReadOnlySpan<byte>) reference
  • string ToHexStringLower(byte[], int, int) reference
  • string ToHexStringLower(byte[]) reference
  • string ToHexStringLower(ReadOnlySpan<byte>) reference
  • bool TryFromBase64Chars(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryFromBase64String(string, Span<byte>, int) reference
  • bool TryToBase64Chars(ReadOnlySpan<byte>, Span<char>, int, Base64FormattingOptions) reference
  • bool TryToHexString(ReadOnlySpan<byte>, Span<byte>, int) reference
  • bool TryToHexString(ReadOnlySpan<byte>, Span<char>, int) reference
  • bool TryToHexStringLower(ReadOnlySpan<byte>, Span<byte>, int) reference
  • bool TryToHexStringLower(ReadOnlySpan<byte>, Span<char>, int) reference

DateOnly

  • void Deconstruct(int, int, int) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference

DateTime

  • DateTime AddMicroseconds(double) reference
  • void Deconstruct(DateOnly, TimeOnly) reference
  • void Deconstruct(int, int, int) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<char>, DateTime) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTime) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTime) reference
  • bool TryParse(string?, IFormatProvider?, DateTime) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTime) reference
  • bool TryParseExact(ReadOnlySpan<char>, string, IFormatProvider?, DateTimeStyles, DateTime) reference
  • Microsecond reference
  • Nanosecond reference

DateTimeOffset

  • DateTimeOffset AddMicroseconds(double) reference
  • void Deconstruct(DateOnly, TimeOnly, TimeSpan) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<char>, DateTimeOffset) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeOffset) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • bool TryParse(string?, IFormatProvider?, DateTimeOffset) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • bool TryParseExact(ReadOnlySpan<char>, string, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • Microsecond reference
  • Nanosecond reference

Decimal

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, decimal) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, decimal) reference
  • bool TryParse(string?, IFormatProvider?, decimal) reference

DefaultInterpolatedStringHandler

Delegate

  • InvocationListEnumerator<TDelegate> EnumerateInvocationList<TDelegate>(TDelegate?) where TDelegate : Delegate reference
  • HasSingleTarget reference

Dictionary<TKey, TValue>

  • void EnsureCapacity<TKey, TValue>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • DictionaryAlternateLookup<TKey, TValue, TAlternateKey> GetAlternateLookup<TKey, TValue, TAlternateKey>() where TKey : notnull reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
    • Note: Returns the free-standing DictionaryAlternateLookup<TKey, TValue, TAlternateKey> rather than the BCL's nested Dictionary<TKey, TValue>.AlternateLookup<TAlternateKey>. Use var for cross-target code.
  • void TrimExcess<TKey, TValue>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • void TrimExcess<TKey, TValue>() reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryGetAlternateLookup<TKey, TValue, TAlternateKey>(DictionaryAlternateLookup<TKey, TValue, TAlternateKey>) where TKey : notnull reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).

DictionaryEntry

  • void Deconstruct(object, object?) reference

Directory

  • DirectoryInfo CreateTempSubdirectory(string?) reference
  • IEnumerable<string> EnumerateDirectories(string, string, EnumerationOptions) reference
  • IEnumerable<string> EnumerateFiles(string, string, EnumerationOptions) reference
  • IEnumerable<string> EnumerateFileSystemEntries(string, string, EnumerationOptions) reference
  • string[] GetDirectories(string, string, EnumerationOptions) reference
  • string[] GetFiles(string, string, EnumerationOptions) reference
  • string[] GetFileSystemEntries(string, string, EnumerationOptions) reference

DirectoryInfo

  • IEnumerable<DirectoryInfo> EnumerateDirectories(string, EnumerationOptions) reference
  • IEnumerable<FileInfo> EnumerateFiles(string, EnumerationOptions) reference
  • IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(string, EnumerationOptions) reference
  • DirectoryInfo[] GetDirectories(string, EnumerationOptions) reference
  • FileInfo[] GetFiles(string, EnumerationOptions) reference
  • FileSystemInfo[] GetFileSystemInfos(string, EnumerationOptions) reference

Double

  • ulong DoubleToUInt64Bits(double)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, double) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<char>, double) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, double) reference
  • bool TryParse(string?, IFormatProvider?, double) reference

Encoder

  • void Convert(ReadOnlySpan<char>, Span<byte>, bool, int, int, bool) reference

Encoding

  • int GetByteCount(ReadOnlySpan<char>) reference
  • int GetBytes(ReadOnlySpan<char>, Span<byte>) reference
  • int GetCharCount(ReadOnlySpan<byte>) reference
  • int GetChars(ReadOnlySpan<byte>, Span<char>) reference
  • string GetString(ReadOnlySpan<byte>) reference
  • bool TryGetBytes(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryGetChars(ReadOnlySpan<byte>, Span<char>, int) reference
  • Latin1 reference
  • Preamble reference
    • Note: Allocates a new array on each access, unlike the BCL property which returns a cached span.

Enum

  • string[] GetNames<TEnum>() where TEnum : struct, Enum reference
  • TEnum[] GetValues<TEnum>() where TEnum : struct, Enum reference
  • Array GetValuesAsUnderlyingType(Type) reference
  • Array GetValuesAsUnderlyingType<TEnum>() where TEnum : struct, Enum reference
  • bool IsDefined<TEnum>(TEnum) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(ReadOnlySpan<char>, bool) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(ReadOnlySpan<char>) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(string, bool) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(string) where TEnum : struct, Enum reference
  • bool TryFormat<TEnum>(TEnum, Span<char>, int, ReadOnlySpan<char>) where TEnum : struct, Enum reference
  • bool TryParse<TEnum>(ReadOnlySpan<char>, bool, TEnum) where TEnum : struct, Enum reference
  • bool TryParse<TEnum>(ReadOnlySpan<char>, TEnum) where TEnum : struct, Enum reference

Enumerable

  • IEnumerable<T> InfiniteSequence<T>(T, T) where T : IAdditionOperators<T, T, T> reference
  • IEnumerable<T> Sequence<T>(T, T, T) where T : INumber<T> reference

Environment

EqualityComparer

  • EqualityComparer<T> Create(Func<T?, T?, bool>, Func<T, int>?) reference
  • EqualityComparer<T> Create<TKey>(Func<T?, TKey?>, IEqualityComparer<TKey>?) reference

EventInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

ExceptionDispatchInfo

  • Exception SetCurrentStackTrace(Exception) reference

FieldInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

File

  • void AppendAllBytes(string, byte[]) reference
  • void AppendAllBytes(string, ReadOnlySpan<byte>) reference
  • Task AppendAllBytesAsync(string, byte[], CancellationToken) reference
  • Task AppendAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) reference
  • Task AppendAllLinesAsync(string, IEnumerable<string>, CancellationToken) reference
  • Task AppendAllLinesAsync(string, IEnumerable<string>, Encoding, CancellationToken) reference
  • void AppendAllText(string, ReadOnlySpan<char>, Encoding) reference
  • void AppendAllText(string, ReadOnlySpan<char>) reference
  • Task AppendAllTextAsync(string, ReadOnlyMemory<char>, CancellationToken) reference
  • Task AppendAllTextAsync(string, ReadOnlyMemory<char>, Encoding, CancellationToken) reference
  • Task AppendAllTextAsync(string, string?, CancellationToken) reference
  • Task AppendAllTextAsync(string, string?, Encoding, CancellationToken) reference
  • FileSystemInfo CreateHardLink(string, string) reference
  • void Move(string, string, bool) reference
  • SafeFileHandle OpenNullHandle() reference
  • Task<byte[]> ReadAllBytesAsync(string, CancellationToken) reference
  • Task<string[]> ReadAllLinesAsync(string, CancellationToken) reference
  • Task<string[]> ReadAllLinesAsync(string, Encoding, CancellationToken) reference
  • Task<string> ReadAllTextAsync(string, CancellationToken) reference
  • Task<string> ReadAllTextAsync(string, Encoding, CancellationToken) reference
  • IAsyncEnumerable<string> ReadLinesAsync(string, CancellationToken) reference
  • IAsyncEnumerable<string> ReadLinesAsync(string, Encoding, CancellationToken) reference
  • Task WriteAllBytesAsync(string, byte[], CancellationToken) reference
  • Task WriteAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) reference
  • Task WriteAllLinesAsync(string, IEnumerable<string>, CancellationToken) reference
  • Task WriteAllLinesAsync(string, IEnumerable<string>, Encoding, CancellationToken) reference
  • void WriteAllText(string, ReadOnlySpan<char>, Encoding) reference
  • void WriteAllText(string, ReadOnlySpan<char>) reference
  • Task WriteAllTextAsync(string, string?, CancellationToken) reference
  • Task WriteAllTextAsync(string, string?, Encoding, CancellationToken) reference

FileInfo

FileUnixMode

  • UnixFileMode GetUnixFileMode(string) reference
  • void SetUnixFileMode(string, UnixFileMode) reference

GC

  • T[] AllocateUninitializedArray<T>(int, bool) reference

Guid

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>) reference
  • Guid CreateVersion7() reference
  • Guid CreateVersion7(DateTimeOffset) reference
  • Guid Parse(ReadOnlySpan<byte>) reference
  • bool TryParse(ReadOnlySpan<byte>, Guid) reference
  • bool TryParse(ReadOnlySpan<char>, Guid) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, Guid) reference
  • bool TryParse(string?, IFormatProvider?, Guid) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, Guid) reference
  • AllBitsSet reference

HashSet

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • HashSetAlternateLookup<T, TAlternate> GetAlternateLookup<T, TAlternate>() reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
    • Note: Returns the free-standing HashSetAlternateLookup<T, TAlternate> rather than the BCL's nested HashSet<T>.AlternateLookup<TAlternate>. Use var for cross-target code.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryGetAlternateLookup<T, TAlternate>(HashSetAlternateLookup<T, TAlternate>) reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
  • bool TryGetValue<T>(T, T) reference

HttpClient

  • Task<byte[]> GetByteArrayAsync(string, CancellationToken) reference
  • Task<byte[]> GetByteArrayAsync(Uri, CancellationToken) reference
  • Task<Stream> GetStreamAsync(string, CancellationToken) reference
  • Task<Stream> GetStreamAsync(Uri, CancellationToken) reference
  • Task<string> GetStringAsync(string, CancellationToken) reference
  • Task<string> GetStringAsync(Uri, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(string?, HttpContent?, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(string?, HttpContent?) reference
  • Task<HttpResponseMessage> PatchAsync(Uri?, HttpContent?, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(Uri?, HttpContent?) reference
  • HttpResponseMessage Send(HttpRequestMessage, CancellationToken) reference
  • HttpResponseMessage Send(HttpRequestMessage, HttpCompletionOption, CancellationToken) reference
  • HttpResponseMessage Send(HttpRequestMessage, HttpCompletionOption) reference
  • HttpResponseMessage Send(HttpRequestMessage) reference

HttpContent

  • void CopyTo(Stream, System.Net.TransportContext?, CancellationToken) reference
  • Task CopyToAsync(Stream, CancellationToken) reference
  • Task CopyToAsync(Stream, System.Net.TransportContext?, CancellationToken) reference
  • Task LoadIntoBufferAsync(CancellationToken) reference
  • Task LoadIntoBufferAsync(long, CancellationToken) reference
  • Task<byte[]> ReadAsByteArrayAsync(CancellationToken) reference
  • Stream ReadAsStream(CancellationToken) reference
  • Task<Stream> ReadAsStreamAsync(CancellationToken) reference
  • Task<string> ReadAsStringAsync(CancellationToken) reference

IDictionary<TKey, TValue>

  • ReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>() where TKey : notnull reference
  • bool Remove<TKey, TValue>(TKey, TValue) where TKey : notnull reference
  • bool TryAdd<TKey, TValue>(TKey, TValue) where TKey : notnull reference

IEnumerable<KeyValuePair<TKey, TValue>>

  • Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(IEqualityComparer<TKey>?) where TKey : notnull reference

IEnumerable

  • IOrderedEnumerable<T> Order<T>(IComparer<T>?) reference
  • IOrderedEnumerable<T> Order<T>() reference
  • IOrderedEnumerable<T> OrderDescending<T>(IComparer<T>?) reference
  • IOrderedEnumerable<T> OrderDescending<T>() reference

IEnumerable

  • IEnumerable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst, TSecond, TThird>(IEnumerable<TSecond>, IEnumerable<TThird>) reference
  • IEnumerable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(IEnumerable<TSecond>) reference

IEnumerable

  • IEnumerable<TResult> FullJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner?, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<(TOuter? Outer, TInner? Inner)> FullJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<IGrouping<TOuter, TInner>> GroupJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<(TOuter Outer, TInner Inner)> Join<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter, TInner?, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter, TInner?, TResult>) reference
  • IEnumerable<(TOuter Outer, TInner? Inner)> LeftJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner, TResult>) reference
  • IEnumerable<(TOuter? Outer, TInner Inner)> RightJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference

IEnumerable

  • IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(Func<TSource, TKey>, Func<TKey, TAccumulate>, Func<TAccumulate, TSource, TAccumulate>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(Func<TSource, TKey>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<TSource> Append<TSource>(TSource) reference
  • IEnumerable<TSource[]> Chunk<TSource>(int) reference
  • IEnumerable<KeyValuePair<TKey, int>> CountBy<TSource, TKey>(Func<TSource, TKey>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<TSource> DistinctBy<TSource, TKey>(Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> DistinctBy<TSource, TKey>(Func<TSource, TKey>) reference
  • TSource ElementAt<TSource>(Index) reference
  • TSource? ElementAtOrDefault<TSource>(Index) reference
  • IEnumerable<TSource> Except<TSource>(IEqualityComparer<TSource>?, TSource[]) reference
  • IEnumerable<TSource> Except<TSource>(TSource, IEqualityComparer<TSource>?) reference
  • IEnumerable<TSource> Except<TSource>(TSource) reference
  • IEnumerable<TSource> ExceptBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> ExceptBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>) reference
  • TSource FirstOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource FirstOrDefault<TSource>(TSource) reference
  • IEnumerable<(int Index, TSource Item)> Index<TSource>() reference
  • IEnumerable<TSource> IntersectBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> IntersectBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>) reference
  • TSource LastOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource LastOrDefault<TSource>(TSource) reference
  • TSource? Max<TSource>(IComparer<TSource>?) reference
  • TSource? MaxBy<TSource, TKey>(Func<TSource, TKey>, IComparer<TKey>?) reference
  • TSource? MaxBy<TSource, TKey>(Func<TSource, TKey>) reference
  • TSource? Min<TSource>(IComparer<TSource>?) reference
  • TSource? MinBy<TSource, TKey>(Func<TSource, TKey>, IComparer<TKey>?) reference
  • TSource? MinBy<TSource, TKey>(Func<TSource, TKey>) reference
  • IEnumerable<TSource> Prepend<TSource>(TSource) reference
  • TSource SingleOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource SingleOrDefault<TSource>(TSource) reference
  • IEnumerable<TSource> SkipLast<TSource>(int) reference
  • IEnumerable<TSource> Take<TSource>(Range) reference
  • IEnumerable<TSource> TakeLast<TSource>(int) reference
  • HashSet<TSource> ToHashSet<TSource>(IEqualityComparer<TSource>?) reference
  • bool TryGetNonEnumeratedCount<TSource>(int) reference
  • IEnumerable<TSource> UnionBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> UnionBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>) reference

IList

  • ReadOnlyCollection<T> AsReadOnly<T>() reference

Int16

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<byte>, short) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<char>, short) reference
  • bool TryParse(string?, IFormatProvider?, short) reference

Int32

  • float Int32BitsToSingle(int)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<byte>, int) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<char>, int) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, int) reference
  • bool TryParse(string?, IFormatProvider?, int) reference

Int64

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<byte>, long) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<char>, long) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, long) reference
  • bool TryParse(string?, IFormatProvider?, long) reference

Interlocked

IntPtr

  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<byte>, nint) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<char>, nint) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, nint) reference
  • bool TryParse(string?, IFormatProvider?, nint) reference
  • bool TryParse(string?, nint) reference
  • bool TryParse(string?, NumberStyles, IFormatProvider?, nint) reference

IPAddress

  • IPAddress Parse(ReadOnlySpan<char>) reference
  • bool TryParse(ReadOnlySpan<byte>, IPAddress?) reference
  • bool TryParse(ReadOnlySpan<char>, IPAddress?) reference

IReadOnlyDictionary<TKey, TValue>

  • TValue GetValueOrDefault<TKey, TValue>(TKey, TValue) where TKey : notnull reference
  • TValue? GetValueOrDefault<TKey, TValue>(TKey) reference

ISet

KeyValuePair<TKey, TValue>

  • void Deconstruct<TKey, TValue>(TKey, TValue) reference

List

  • void AddRange<T>(ReadOnlySpan<T>) reference
  • void CopyTo<T>(Span<T>) reference
  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
    • Note: Returns void on older targets; the BCL returns int (the new capacity).
  • void InsertRange<T>(int, ReadOnlySpan<T>) reference
  • void TrimExcess<T>()
    • Note: No-op on older targets; the BCL shrinks the backing storage.

Math

MD5

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

MemberInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool HasSameMetadataDefinitionAs(MemberInfo) reference
  • bool IsNullable()

MethodInfo

  • T CreateDelegate<T>(object?) where T : Delegate reference
  • T CreateDelegate<T>() where T : Delegate reference

ObjectDisposedException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

OperatingSystem

OrderedDictionary<TKey, TValue>

  • bool TryAdd<TKey, TValue>(TKey, TValue, int) where TKey : notnull reference
  • bool TryGetValue<TKey, TValue>(TKey, TValue, int) where TKey : notnull reference

Parallel

  • Task ForEachAsync<T>(IAsyncEnumerable<T>, CancellationToken, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IAsyncEnumerable<T>, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IAsyncEnumerable<T>, ParallelOptions, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, CancellationToken, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, ParallelOptions, Func<T, CancellationToken, ValueTask>) reference

ParameterInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

Path

  • string Combine(ReadOnlySpan<string>) reference
  • bool EndsInDirectorySeparator(ReadOnlySpan<char>) reference
  • bool EndsInDirectorySeparator(string) reference
  • bool Exists(string?) reference
  • ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetExtension(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetFileName(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetFileNameWithoutExtension(ReadOnlySpan<char>) reference
  • string GetRelativePath(string, string) reference
  • bool HasExtension(ReadOnlySpan<char>) reference
  • bool IsPathRooted(ReadOnlySpan<char>) reference
  • string Join(string?[]) reference
  • ReadOnlySpan<char> TrimEndingDirectorySeparator(ReadOnlySpan<char>) reference
  • string TrimEndingDirectorySeparator(string) reference

PriorityQueue<TElement, TPriority>

  • bool Remove<TElement, TPriority>(TElement, TElement, TPriority, IEqualityComparer<TElement>?) reference

Process

  • void Kill(bool) reference
  • (byte[] StandardOutput, byte[] StandardError) ReadAllBytes(TimeSpan?) reference
  • Task<(byte[] StandardOutput, byte[] StandardError)> ReadAllBytesAsync(CancellationToken) reference
  • IAsyncEnumerable<ProcessOutputLine> ReadAllLinesAsync(CancellationToken) reference
  • (string StandardOutput, string StandardError) ReadAllText(TimeSpan?) reference
  • Task<(string StandardOutput, string StandardError)> ReadAllTextAsync(CancellationToken) reference
  • Task WaitForExitAsync(CancellationToken) reference
  • ProcessExitStatus Run(ProcessStartInfo, TimeSpan?) reference
  • ProcessExitStatus Run(string, IList<string>?, bool, TimeSpan?) reference
    • Note: When silent is true, standard output and error are suppressed by redirecting and discarding them (rather than binding to the null device as on net11); standard input remains connected.
  • ProcessTextOutput RunAndCaptureText(ProcessStartInfo, TimeSpan?) reference
  • ProcessTextOutput RunAndCaptureText(string, IList<string>?, TimeSpan?) reference
  • Task<ProcessTextOutput> RunAndCaptureTextAsync(ProcessStartInfo, CancellationToken) reference
  • Task<ProcessTextOutput> RunAndCaptureTextAsync(string, IList<string>?, CancellationToken) reference
  • Task<ProcessExitStatus> RunAsync(ProcessStartInfo, CancellationToken) reference
  • Task<ProcessExitStatus> RunAsync(string, IList<string>?, bool, CancellationToken) reference
    • Note: When silent is true, standard output and error are suppressed by redirecting and discarding them (rather than binding to the null device as on net11); standard input remains connected.
  • int StartAndForget(ProcessStartInfo) reference
  • int StartAndForget(string, IList<string>?) reference
  • bool TryGetProcessById(int, Process?) reference

PropertyInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

Queue

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryDequeue<T>(T) reference
  • bool TryPeek<T>(T) reference

Random

RandomNumberGenerator

ReadOnlySpan

  • bool EndsWith(string, StringComparison) reference
  • SpanLineEnumerator EnumerateLines() reference
  • int GetNormalizedLength(NormalizationForm) reference
  • bool IsNormalized(NormalizationForm) reference
  • bool SequenceEqual(string) reference
  • int Split(Span<Range>, char, StringSplitOptions) reference
  • int Split(Span<Range>, ReadOnlySpan<char>, StringSplitOptions) reference
  • int SplitAny(Span<Range>, ReadOnlySpan<char>, StringSplitOptions) reference
  • int SplitAny(Span<Range>, ReadOnlySpan<string>, StringSplitOptions) reference
  • bool StartsWith(string, StringComparison) reference
  • bool TryNormalize(Span<char>, int, NormalizationForm) reference

ReadOnlySpan

  • int CommonPrefixLength<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CommonPrefixLength<T>(ReadOnlySpan<T>) reference
  • bool Contains<T>(T, IEqualityComparer<T>?) reference
  • bool Contains<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExceptInRange<T>(T, T) where T : IComparable<T> reference
  • bool ContainsAnyInRange<T>(T, T) where T : IComparable<T> reference
  • int CountAny<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CountAny<T>(ReadOnlySpan<T>) where T : IEquatable<T>? reference
  • int CountAny<T>(SearchValues<T>) where T : IEquatable<T>? reference
  • bool EndsWith<T>(T) where T : IEquatable<T>? reference
  • int IndexOf<T>(T, IEqualityComparer<T>?) reference
  • int IndexOfAny<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int IndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • T? Max<T>(IComparer<T>?) reference
  • T? Max<T>() reference
  • T? Min<T>(IComparer<T>?) reference
  • T? Min<T>() reference
  • SpanSplitEnumerator<T> Split<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> Split<T>(T) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> SplitAny<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> SplitAny<T>(SearchValues<T>) where T : IEquatable<T> reference
  • bool StartsWith<T>(T) where T : IEquatable<T>? reference

Regex

  • int Count(ReadOnlySpan<char>, int) reference
  • int Count(ReadOnlySpan<char>) reference
  • int Count(string) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, int) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, int, int) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, int) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>) reference
  • bool IsMatch(ReadOnlySpan<char>, int) reference
  • bool IsMatch(ReadOnlySpan<char>) reference
  • int Count(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • int Count(ReadOnlySpan<char>, string, RegexOptions) reference
  • int Count(ReadOnlySpan<char>, string) reference
  • int Count(string, string, RegexOptions, TimeSpan) reference
  • int Count(string, string, RegexOptions) reference
  • int Count(string, string) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string, RegexOptions) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string, RegexOptions) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string) reference
  • bool IsMatch(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • bool IsMatch(ReadOnlySpan<char>, string, RegexOptions) reference
  • bool IsMatch(ReadOnlySpan<char>, string) reference

RuntimeFeature

SByte

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<byte>, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, sbyte) reference
  • bool TryParse(string?, IFormatProvider?, sbyte) reference

SHA1

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA256

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA384

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA512

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

Single

  • int SingleToInt32Bits(float)
  • uint SingleToUInt32Bits(float)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, float) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<char>, float) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, float) reference
  • bool TryParse(string?, IFormatProvider?, float) reference

Socket

  • ValueTask ConnectAsync(EndPoint, CancellationToken) reference
  • ValueTask DisconnectAsync(bool, CancellationToken) reference
  • ValueTask<SocketReceiveFromResult> ReceiveFromAsync(Memory<byte>, SocketFlags, EndPoint, CancellationToken) reference
  • ValueTask<int> SendToAsync(ReadOnlyMemory<byte>, SocketFlags, EndPoint, CancellationToken) reference

SortedList<TKey, TValue>

  • TKey GetKeyAtIndex<TKey, TValue>(int) reference
  • TValue GetValueAtIndex<TKey, TValue>(int) reference

Span

Span

  • int CommonPrefixLength<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CommonPrefixLength<T>(ReadOnlySpan<T>) reference
  • bool Contains<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExceptInRange<T>(T, T) where T : IComparable<T> reference
  • bool ContainsAnyInRange<T>(T, T) where T : IComparable<T> reference
  • int IndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • void Sort<T>(Comparison<T>)
  • void Sort<T>() where T : IComparable<T> reference

Span

  • void Sort<TKey, TValue, TComparer>(Span<TValue>, TComparer) where TComparer : IComparer<TKey> reference
  • void Sort<TKey, TValue>(Span<TValue>, Comparison<TKey>) reference
  • void Sort<TKey, TValue>(Span<TValue>) reference

Stack

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryPeek<T>(T) reference
  • bool TryPop<T>(T) reference

Stopwatch

Stream

  • Task CopyToAsync(Stream, CancellationToken) reference
  • ValueTask DisposeAsync() reference
  • int Read(Span<byte>) reference
  • ValueTask<int> ReadAsync(Memory<byte>, CancellationToken) reference
  • int ReadAtLeast(Span<byte>, int, bool) reference
  • ValueTask<int> ReadAtLeastAsync(Memory<byte>, int, bool, CancellationToken) reference
  • void ReadExactly(byte[], int, int) reference
  • void ReadExactly(Span<byte>) reference
  • ValueTask ReadExactlyAsync(byte[], int, int, CancellationToken) reference
  • ValueTask ReadExactlyAsync(Memory<byte>, CancellationToken) reference
  • void Write(ReadOnlySpan<byte>) reference
  • ValueTask WriteAsync(ReadOnlyMemory<byte>, CancellationToken) reference

String

  • bool Contains(char, StringComparison) reference
  • bool Contains(char) reference
  • bool Contains(string, StringComparison) reference
  • void CopyTo(Span<char>) reference
  • bool EndsWith(char, StringComparison) reference
  • bool EndsWith(char) reference
  • int GetHashCode(StringComparison) reference
  • int IndexOf(char, int, int, StringComparison) reference
  • int IndexOf(char, int, StringComparison) reference
  • int IndexOf(char, StringComparison) reference
  • int LastIndexOf(char, int, int, StringComparison) reference
  • int LastIndexOf(char, int, StringComparison) reference
  • int LastIndexOf(char, StringComparison) reference
  • string ReplaceLineEndings(string) reference
  • string ReplaceLineEndings() reference
  • string[] Split(char, int, StringSplitOptions) reference
  • string[] Split(char, StringSplitOptions) reference
  • string[] Split(string, int, StringSplitOptions) reference
  • string[] Split(string, StringSplitOptions) reference
  • bool StartsWith(char, StringComparison) reference
  • bool StartsWith(char) reference
  • bool TryCopyTo(Span<char>) reference
  • string Concat(ReadOnlySpan<object?>) reference
  • string Concat(ReadOnlySpan<string?>) reference
  • string Create<TState>(int, TState, System.Buffers.SpanAction<char, TState>) reference
  • int GetHashCode(ReadOnlySpan<char>, StringComparison) reference
  • int GetHashCode(ReadOnlySpan<char>) reference
  • string Join(char, object?[]) reference
  • string Join(char, ReadOnlySpan<object?>) reference
  • string Join(char, ReadOnlySpan<string?>) reference
  • string Join(char, string?[], int, int) reference
  • string Join(char, string?[]) reference
  • string Join(string?, ReadOnlySpan<object?>) reference
  • string Join(string?, ReadOnlySpan<string?>) reference
  • string Join<T>(char, IEnumerable<T>) reference

StringBuilder

  • StringBuilder Append(StringBuilder, AppendInterpolatedStringHandler) reference
  • StringBuilder Append(StringBuilder, IFormatProvider?, AppendInterpolatedStringHandler) reference
  • StringBuilder Append(StringBuilder, IFormatProvider?, StringBuilder.AppendInterpolatedStringHandler) reference
  • `S

Truncated — view the full README on GitHub.

Contributors

(top 30 of 38)

SimonCropp

1,963 commits

dependabot[bot]

39 commits

pengweiqhca

9 commits

alastairlundy

7 commits

SimonCropp/Polyfill

Source only package that exposes newer APIs, .net features, and C# features to older runtimes.

487

stars

2,083

commits

C#

primary language

Sep 10, 2026

updated

README

Polyfill

Build status Polyfill NuGet Status

Source only package that exposes newer .NET and C# features to older runtimes.

The package targets netstandard2.0 and is designed to support the following runtimes.

  • net461, net462, net47, net471, net472, net48, net481
  • netcoreapp2.0, netcoreapp2.1, netcoreapp3.0, netcoreapp3.1
  • net5.0, net6.0, net7.0, net8.0, net9.0, net10.0, net11.0
  • uap10

API count: 1031

Per Target Framework

TargetAPIs
net461972
net462972
net47971
net471970
net472966
net48966
net481966
netstandard2.0968
netstandard2.1821
netcoreapp2.0891
netcoreapp2.1832
netcoreapp2.2832
netcoreapp3.0779
netcoreapp3.1778
net5.0650
net6.0555
net7.0402
net8.0283
net9.0189
net10.0135
net11.058
uap10.0958

See Milestones for release notes.

Powered by

JetBrains logo.

Nuget

TargetFrameworks

It is recommended that projects that consume Polyfill multi-target all TFMs that the project is expected to be consumed in. See Polyfill and TargetFrameworks

SDK / LangVersion

This project uses features from the newest stable SDK and C# language. As such consuming projects should target those:

LangVersion

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <LangVersion>latest</LangVersion>

global.json

{
  "sdk": {
    "version": "10.0.300",
    "rollForward": "latestFeature"
  }
}

Assembly size impact

Assembly Sizes

Empty AssemblyWith PolyfillDiffEnsureArgumentExceptionsStringInterpolationNullability
netstandard2.08.0KB358.5KB+350.5KB+7.5KB+6.5KB+7.5KB+12.0KB
netstandard2.18.5KB312.5KB+304.0KB+9.0KB+6.5KB+9.0KB+13.5KB
net4618.5KB357.0KB+348.5KB+7.5KB+6.5KB+8.0KB+12.5KB
net4627.0KB360.5KB+353.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net477.0KB360.5KB+353.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net4718.5KB359.5KB+351.0KB+7.5KB+6.5KB+7.5KB+12.0KB
net4728.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
net488.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
net4818.5KB358.0KB+349.5KB+8.0KB+6.5KB+8.0KB+12.5KB
netcoreapp2.09.0KB336.0KB+327.0KB+8.5KB+6.5KB+9.0KB+13.5KB
netcoreapp2.19.0KB316.0KB+307.0KB+9.0KB+6.5KB+9.0KB+13.5KB
netcoreapp2.29.0KB316.0KB+307.0KB+9.0KB+6.5KB+9.0KB+13.5KB
netcoreapp3.09.5KB308.5KB+299.0KB+9.0KB+6.5KB+9.0KB+14.0KB
netcoreapp3.19.5KB307.0KB+297.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net5.09.5KB271.0KB+261.5KB+9.0KB+6.5KB+9.0KB+13.5KB
net6.010.0KB212.5KB+202.5KB+10.0KB+7.0KB+512bytes+3.5KB
net7.010.0KB175.0KB+165.0KB+11.5KB+8.0KB+512bytes+3.0KB
net8.09.5KB145.5KB+136.0KB+8.5KB+512bytes+3.0KB
net9.09.5KB98.5KB+89.0KB+8.5KB+512bytes+3.5KB
net10.010.0KB76.0KB+66.0KB+8.5KB+512bytes+3.5KB
net11.010.0KB20.5KB+10.5KB+9.0KB+512bytes+3.5KB

Assembly Sizes with EmbedUntrackedSources

Empty AssemblyWith PolyfillDiffEnsureArgumentExceptionsStringInterpolationNullability
netstandard2.08.0KB524.4KB+516.4KB+15.2KB+8.2KB+12.4KB+17.4KB
netstandard2.18.5KB451.8KB+443.3KB+16.7KB+8.2KB+13.9KB+18.9KB
net4618.5KB524.0KB+515.5KB+15.2KB+8.2KB+12.9KB+17.9KB
net4627.0KB527.5KB+520.5KB+16.7KB+8.2KB+13.9KB+18.9KB
net477.0KB527.2KB+520.2KB+16.7KB+8.2KB+13.9KB+18.9KB
net4718.5KB525.8KB+517.3KB+15.2KB+8.2KB+12.4KB+17.4KB
net4728.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
net488.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
net4818.5KB523.3KB+514.8KB+15.7KB+8.2KB+12.9KB+17.9KB
netcoreapp2.09.0KB491.3KB+482.3KB+16.2KB+8.2KB+13.9KB+18.9KB
netcoreapp2.19.0KB459.0KB+450.0KB+16.7KB+8.2KB+13.9KB+18.9KB
netcoreapp2.29.0KB459.0KB+450.0KB+16.7KB+8.2KB+13.9KB+18.9KB
netcoreapp3.09.5KB442.7KB+433.2KB+16.7KB+8.2KB+13.9KB+19.4KB
netcoreapp3.19.5KB441.2KB+431.7KB+16.7KB+8.2KB+13.9KB+18.9KB
net5.09.5KB387.0KB+377.5KB+16.7KB+8.2KB+13.9KB+18.9KB
net6.010.0KB308.4KB+298.4KB+17.7KB+8.7KB+1.1KB+4.2KB
net7.010.0KB252.3KB+242.3KB+19.1KB+9.4KB+1.1KB+3.7KB
net8.09.5KB207.3KB+197.8KB+16.0KB+299bytes+1.1KB+3.7KB
net9.09.5KB139.1KB+129.6KB+16.0KB+1.1KB+4.2KB
net10.010.0KB108.0KB+98.0KB+16.0KB+1.1KB+4.2KB
net11.010.0KB30.3KB+20.3KB+16.5KB+1.1KB+4.2KB

PolyfillLib

To consume Polyfill as a library (instead of a source-only package) see PolyfillLib

Troubleshooting

Make sure DefineConstants is not set from dotnet CLI, which would override important constants set by Polyfill.

Instead of using dotnet publish -p:DefineConstants=MY_CONSTANT, set the constant indirectly in the project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <DefineConstants Condition="'$(MyConstant)' == 'true'">$(DefineConstants);MY_CONSTANT</DefineConstants>

and use dotnet publish -p:MyConstant=true.

Included polyfills

ModuleInitializerAttribute

Reference: Module Initializers

static bool InitCalled;

[Test]
public async Task ModuleInitTest() =>
    await Assert.That(InitCalled).IsTrue();

[ModuleInitializer]
public static void ModuleInit() =>
    InitCalled = true;

snippet source | anchor

IsExternalInit

Reference: init (C# Reference)

class InitSample
{
    public int Member { get; init; }
}

snippet source | anchor

Nullable attributes

Reference: Nullable reference types

Required attributes

Reference: C# required modifier

public class Person
{
    public Person()
    {
    }

    [SetsRequiredMembers]
    public Person(string name) =>
        Name = name;

    public required string Name { get; init; }
}

snippet source | anchor

CompilerFeatureRequiredAttribute

Indicates that compiler support for a particular feature is required for the location where this attribute is applied.

CollectionBuilderAttribute

Can be used to make types compatible with collection expressions

ConstantExpectedAttribute

Indicates that the specified method parameter expects a constant.

SkipLocalsInit

Reference: SkipLocalsInitAttribute

the SkipLocalsInit attribute prevents the compiler from setting the .locals init flag when emitting to metadata. The SkipLocalsInit attribute is a single-use attribute and can be applied to a method, a property, a class, a struct, an interface, or a module, but not to an assembly. SkipLocalsInit is an alias for SkipLocalsInitAttribute.

class SkipLocalsInitSample
{
    [SkipLocalsInit]
    static void ReadUninitializedMemory()
    {
        Span<int> numbers = stackalloc int[120];
        for (var i = 0; i < 120; i++)
        {
            Console.WriteLine(numbers[i]);
        }
    }
}

snippet source | anchor

Index and Range

Reference: Indices and ranges

If consuming in a project that targets net461 or net462, a reference to System.ValueTuple is required. See References: System.ValueTuple.

class IndexRangeSample
{
    [Test]
    public async Task Range()
    {
        var substring = "value"[2..];
        await Assert.That(substring).IsEqualTo("lue");
    }

    [Test]
    public async Task Index()
    {
        var ch = "value"[^2];
        await Assert.That(ch).IsEqualTo('u');
    }

    [Test]
    public async Task ArrayIndex()
    {
        var array = new[]
        {
            "value1",
            "value2"
        };

        var value = array[^2];

        await Assert.That(value).IsEqualTo("value1");
    }
}

snippet source | anchor

OverloadResolutionPriority

C# introduces a new attribute, System.Runtime.CompilerServices.OverloadResolutionPriority, that can be used by API authors to adjust the relative priority of overloads within a single type as a means of steering API consumers to use specific APIs, even if those APIs would normally be considered ambiguous or otherwise not be chosen by C#'s overload resolution rules. This helps framework and library authors guide API usage as they APIs as they develop new and better patterns.

The OverloadResolutionPriorityAttribute can be used in conjunction with the ObsoleteAttribute. A library author may mark properties, methods, types and other programming elements as obsolete, while leaving them in place for backwards compatibility. Using programming elements marked with the ObsoleteAttribute will result in compiler warnings or errors. However, the type or member is still visible to overload resolution and may be selected over a better overload or cause an ambiguity failure. The OverloadResolutionPriorityAttribute lets library authors fix these problems by lowering the priority of obsolete members when there are better alternatives.

Usage

public class OverloadResolutionPriorityAttributeTests
{
    [Test]
    public Task Run()
    {
        int[] arr = [1, 2, 3];
        //Prints "Span" because resolution priority is higher
        Method(arr);
        return Task.CompletedTask;
    }

    [OverloadResolutionPriority(2)]
    static void Method(ReadOnlySpan<int> list) =>
        Console.WriteLine("Span");

    [OverloadResolutionPriority(1)]
    static void Method(int[] list) =>
        Console.WriteLine("Array");
}

snippet source | anchor

UnscopedRefAttribute

Reference: Low Level Struct Improvements

struct UnscopedRefUsage
{
    int field1;

    [UnscopedRef] ref int Prop1 => ref field1;
}

snippet source | anchor

RequiresPreviewFeaturesAttribute

CallerArgumentExpressionAttribute

Reference: CallerArgumentExpression

static class FileUtil
{
    public static void FileExists(string path, [CallerArgumentExpression("path")] string name = "")
    {
        if (!File.Exists(path))
        {
            throw new ArgumentException($"File not found. Path: {path}", name);
        }
    }
}

static class FileUtilUsage
{
    public static string[] Method(string path)
    {
        FileUtil.FileExists(path);
        return File.ReadAllLines(path);
    }
}

snippet source | anchor

InterpolatedStringHandler

Enable by adding an MSBuild property PolyStringInterpolation

<PropertyGroup>
  ...
  <PolyStringInterpolation>true</PolyStringInterpolation>
</PropertyGroup>

References: String Interpolation in C# 10 and .NET 6, Write a custom string interpolation handler

[!IMPORTANT] In the below extension method list, the methods using AppendInterpolatedStringHandler parameter are not extensions because the compiler prefers to use the overload with string parameter instead.

StringSyntaxAttribute

Reference: .NET 7 - The StringSyntaxAttribute

Trimming annotation attributes

Reference: Prepare .NET libraries for trimming

Platform compatibility

Reference: Platform compatibility analyzer

StackTraceHiddenAttribute

Reference: C# – Hide a method from the stack trace

UnmanagedCallersOnly

Reference: Improvements in native code interop in .NET 5.0

SuppressGCTransition

DisableRuntimeMarshalling

Extensions

The class Polyfill includes the following extension methods:

Extension methods

ArgumentException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

  • void ThrowIfNullOrEmpty(string?) reference
  • void ThrowIfNullOrWhiteSpace(string?) reference

ArgumentNullException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

ArgumentOutOfRangeException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

  • void ThrowIfEqual<T>(T, T) where T : IEquatable<T>? reference
  • void ThrowIfGreaterThan(nint, nint)
  • void ThrowIfGreaterThan<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfGreaterThanOrEqual(nint, nint)
  • void ThrowIfGreaterThanOrEqual<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfLessThan(nint, nint)
  • void ThrowIfLessThan<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfLessThanOrEqual(nint, nint)
  • void ThrowIfLessThanOrEqual<T>(T, T) where T : IComparable<T> reference
  • void ThrowIfNegative(nint) reference
  • void ThrowIfNegative<T>(T) where T : struct, IComparable<T> reference
  • void ThrowIfNegativeOrZero(nint)
  • void ThrowIfNegativeOrZero<T>(T) where T : struct, IComparable<T> reference
  • void ThrowIfNotEqual<T>(T, T) where T : IEquatable<T>? reference
  • void ThrowIfZero(nint)
  • void ThrowIfZero<T>(T) where T : struct, IEquatable<T> reference

ArraySegment

Base64

  • OperationStatus DecodeFromChars(ReadOnlySpan<char>, Span<byte>, int, int, bool) reference
  • int DecodeFromChars(ReadOnlySpan<char>, Span<byte>) reference
  • byte[] DecodeFromChars(ReadOnlySpan<char>) reference
  • byte[] DecodeFromUtf8(ReadOnlySpan<byte>) reference
  • OperationStatus EncodeToChars(ReadOnlySpan<byte>, Span<char>, int, int, bool) reference
  • int EncodeToChars(ReadOnlySpan<byte>, Span<char>) reference
  • char[] EncodeToChars(ReadOnlySpan<byte>) reference
  • string EncodeToString(ReadOnlySpan<byte>) reference
  • byte[] EncodeToUtf8(ReadOnlySpan<byte>) reference
  • int GetEncodedLength(int) reference
  • int GetMaxDecodedLength(int) reference
  • bool TryDecodeFromChars(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryEncodeToChars(ReadOnlySpan<byte>, Span<char>, int) reference

BinaryPrimitives

  • double ReadDoubleBigEndian(ReadOnlySpan<byte>) reference
  • double ReadDoubleLittleEndian(ReadOnlySpan<byte>) reference
  • float ReadSingleBigEndian(ReadOnlySpan<byte>) reference
  • float ReadSingleLittleEndian(ReadOnlySpan<byte>) reference
  • bool TryReadDoubleBigEndian(ReadOnlySpan<byte>, double) reference
  • bool TryReadDoubleLittleEndian(ReadOnlySpan<byte>, double) reference
  • bool TryReadSingleBigEndian(ReadOnlySpan<byte>, float) reference
  • bool TryReadSingleLittleEndian(ReadOnlySpan<byte>, float) reference
  • bool TryWriteDoubleBigEndian(Span<byte>, double) reference
  • bool TryWriteDoubleLittleEndian(Span<byte>, double) reference
  • bool TryWriteSingleBigEndian(Span<byte>, float) reference
  • bool TryWriteSingleLittleEndian(Span<byte>, float) reference
  • void WriteDoubleBigEndian(Span<byte>, double) reference
  • void WriteDoubleLittleEndian(Span<byte>, double) reference
  • void WriteSingleBigEndian(Span<byte>, float) reference
  • void WriteSingleLittleEndian(Span<byte>, float) reference

Boolean

Byte

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, byte) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<char>, byte) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, byte) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, byte) reference
  • bool TryParse(string?, IFormatProvider?, byte) reference

CancellationToken

  • CancellationTokenRegistration Register(Action<object?, CancellationToken>, object?) reference
  • CancellationTokenRegistration UnsafeRegister(Action<object?, CancellationToken>, object?) reference
  • CancellationTokenRegistration UnsafeRegister(Action<object?>, object?) reference

CancellationTokenSource

Capture

Char

ConcurrentBag

ConcurrentDictionary<TKey, TValue>

  • TValue GetOrAdd<TKey, TValue, TArg>(TKey, Func<TKey, TArg, TValue>, TArg) where TKey : notnull reference

ConcurrentQueue

ConditionalWeakTable<TKey, TValue>

  • bool Remove<TKey, TValue>(TKey, TValue) where TKey : class where TValue : class reference
    • Note: Lookup and removal are not performed under the table lock, so the operation is not atomic with regard to concurrent mutations.

Console

  • SafeFileHandle OpenStandardErrorHandle() reference
  • SafeFileHandle OpenStandardInputHandle() reference
  • SafeFileHandle OpenStandardOutputHandle() reference

Convert

  • OperationStatus FromHexString(ReadOnlySpan<byte>, Span<byte>, int, int) reference
  • byte[] FromHexString(ReadOnlySpan<byte>) reference
  • OperationStatus FromHexString(ReadOnlySpan<char>, Span<byte>, int, int) reference
  • byte[] FromHexString(ReadOnlySpan<char>) reference
  • OperationStatus FromHexString(string, Span<byte>, int, int) reference
  • byte[] FromHexString(string) reference
  • string ToHexString(byte[], int, int) reference
  • string ToHexString(byte[]) reference
  • string ToHexString(ReadOnlySpan<byte>) reference
  • string ToHexStringLower(byte[], int, int) reference
  • string ToHexStringLower(byte[]) reference
  • string ToHexStringLower(ReadOnlySpan<byte>) reference
  • bool TryFromBase64Chars(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryFromBase64String(string, Span<byte>, int) reference
  • bool TryToBase64Chars(ReadOnlySpan<byte>, Span<char>, int, Base64FormattingOptions) reference
  • bool TryToHexString(ReadOnlySpan<byte>, Span<byte>, int) reference
  • bool TryToHexString(ReadOnlySpan<byte>, Span<char>, int) reference
  • bool TryToHexStringLower(ReadOnlySpan<byte>, Span<byte>, int) reference
  • bool TryToHexStringLower(ReadOnlySpan<byte>, Span<char>, int) reference

DateOnly

  • void Deconstruct(int, int, int) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference

DateTime

  • DateTime AddMicroseconds(double) reference
  • void Deconstruct(DateOnly, TimeOnly) reference
  • void Deconstruct(int, int, int) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<char>, DateTime) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTime) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTime) reference
  • bool TryParse(string?, IFormatProvider?, DateTime) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTime) reference
  • bool TryParseExact(ReadOnlySpan<char>, string, IFormatProvider?, DateTimeStyles, DateTime) reference
  • Microsecond reference
  • Nanosecond reference

DateTimeOffset

  • DateTimeOffset AddMicroseconds(double) reference
  • void Deconstruct(DateOnly, TimeOnly, TimeSpan) reference
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<char>, DateTimeOffset) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeOffset) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • bool TryParse(string?, IFormatProvider?, DateTimeOffset) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • bool TryParseExact(ReadOnlySpan<char>, string, IFormatProvider?, DateTimeStyles, DateTimeOffset) reference
  • Microsecond reference
  • Nanosecond reference

Decimal

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, decimal) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, decimal) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, decimal) reference
  • bool TryParse(string?, IFormatProvider?, decimal) reference

DefaultInterpolatedStringHandler

Delegate

  • InvocationListEnumerator<TDelegate> EnumerateInvocationList<TDelegate>(TDelegate?) where TDelegate : Delegate reference
  • HasSingleTarget reference

Dictionary<TKey, TValue>

  • void EnsureCapacity<TKey, TValue>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • DictionaryAlternateLookup<TKey, TValue, TAlternateKey> GetAlternateLookup<TKey, TValue, TAlternateKey>() where TKey : notnull reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
    • Note: Returns the free-standing DictionaryAlternateLookup<TKey, TValue, TAlternateKey> rather than the BCL's nested Dictionary<TKey, TValue>.AlternateLookup<TAlternateKey>. Use var for cross-target code.
  • void TrimExcess<TKey, TValue>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • void TrimExcess<TKey, TValue>() reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryGetAlternateLookup<TKey, TValue, TAlternateKey>(DictionaryAlternateLookup<TKey, TValue, TAlternateKey>) where TKey : notnull reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).

DictionaryEntry

  • void Deconstruct(object, object?) reference

Directory

  • DirectoryInfo CreateTempSubdirectory(string?) reference
  • IEnumerable<string> EnumerateDirectories(string, string, EnumerationOptions) reference
  • IEnumerable<string> EnumerateFiles(string, string, EnumerationOptions) reference
  • IEnumerable<string> EnumerateFileSystemEntries(string, string, EnumerationOptions) reference
  • string[] GetDirectories(string, string, EnumerationOptions) reference
  • string[] GetFiles(string, string, EnumerationOptions) reference
  • string[] GetFileSystemEntries(string, string, EnumerationOptions) reference

DirectoryInfo

  • IEnumerable<DirectoryInfo> EnumerateDirectories(string, EnumerationOptions) reference
  • IEnumerable<FileInfo> EnumerateFiles(string, EnumerationOptions) reference
  • IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(string, EnumerationOptions) reference
  • DirectoryInfo[] GetDirectories(string, EnumerationOptions) reference
  • FileInfo[] GetFiles(string, EnumerationOptions) reference
  • FileSystemInfo[] GetFileSystemInfos(string, EnumerationOptions) reference

Double

  • ulong DoubleToUInt64Bits(double)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, double) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<char>, double) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, double) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, double) reference
  • bool TryParse(string?, IFormatProvider?, double) reference

Encoder

  • void Convert(ReadOnlySpan<char>, Span<byte>, bool, int, int, bool) reference

Encoding

  • int GetByteCount(ReadOnlySpan<char>) reference
  • int GetBytes(ReadOnlySpan<char>, Span<byte>) reference
  • int GetCharCount(ReadOnlySpan<byte>) reference
  • int GetChars(ReadOnlySpan<byte>, Span<char>) reference
  • string GetString(ReadOnlySpan<byte>) reference
  • bool TryGetBytes(ReadOnlySpan<char>, Span<byte>, int) reference
  • bool TryGetChars(ReadOnlySpan<byte>, Span<char>, int) reference
  • Latin1 reference
  • Preamble reference
    • Note: Allocates a new array on each access, unlike the BCL property which returns a cached span.

Enum

  • string[] GetNames<TEnum>() where TEnum : struct, Enum reference
  • TEnum[] GetValues<TEnum>() where TEnum : struct, Enum reference
  • Array GetValuesAsUnderlyingType(Type) reference
  • Array GetValuesAsUnderlyingType<TEnum>() where TEnum : struct, Enum reference
  • bool IsDefined<TEnum>(TEnum) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(ReadOnlySpan<char>, bool) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(ReadOnlySpan<char>) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(string, bool) where TEnum : struct, Enum reference
  • TEnum Parse<TEnum>(string) where TEnum : struct, Enum reference
  • bool TryFormat<TEnum>(TEnum, Span<char>, int, ReadOnlySpan<char>) where TEnum : struct, Enum reference
  • bool TryParse<TEnum>(ReadOnlySpan<char>, bool, TEnum) where TEnum : struct, Enum reference
  • bool TryParse<TEnum>(ReadOnlySpan<char>, TEnum) where TEnum : struct, Enum reference

Enumerable

  • IEnumerable<T> InfiniteSequence<T>(T, T) where T : IAdditionOperators<T, T, T> reference
  • IEnumerable<T> Sequence<T>(T, T, T) where T : INumber<T> reference

Environment

EqualityComparer

  • EqualityComparer<T> Create(Func<T?, T?, bool>, Func<T, int>?) reference
  • EqualityComparer<T> Create<TKey>(Func<T?, TKey?>, IEqualityComparer<TKey>?) reference

EventInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

ExceptionDispatchInfo

  • Exception SetCurrentStackTrace(Exception) reference

FieldInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

File

  • void AppendAllBytes(string, byte[]) reference
  • void AppendAllBytes(string, ReadOnlySpan<byte>) reference
  • Task AppendAllBytesAsync(string, byte[], CancellationToken) reference
  • Task AppendAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) reference
  • Task AppendAllLinesAsync(string, IEnumerable<string>, CancellationToken) reference
  • Task AppendAllLinesAsync(string, IEnumerable<string>, Encoding, CancellationToken) reference
  • void AppendAllText(string, ReadOnlySpan<char>, Encoding) reference
  • void AppendAllText(string, ReadOnlySpan<char>) reference
  • Task AppendAllTextAsync(string, ReadOnlyMemory<char>, CancellationToken) reference
  • Task AppendAllTextAsync(string, ReadOnlyMemory<char>, Encoding, CancellationToken) reference
  • Task AppendAllTextAsync(string, string?, CancellationToken) reference
  • Task AppendAllTextAsync(string, string?, Encoding, CancellationToken) reference
  • FileSystemInfo CreateHardLink(string, string) reference
  • void Move(string, string, bool) reference
  • SafeFileHandle OpenNullHandle() reference
  • Task<byte[]> ReadAllBytesAsync(string, CancellationToken) reference
  • Task<string[]> ReadAllLinesAsync(string, CancellationToken) reference
  • Task<string[]> ReadAllLinesAsync(string, Encoding, CancellationToken) reference
  • Task<string> ReadAllTextAsync(string, CancellationToken) reference
  • Task<string> ReadAllTextAsync(string, Encoding, CancellationToken) reference
  • IAsyncEnumerable<string> ReadLinesAsync(string, CancellationToken) reference
  • IAsyncEnumerable<string> ReadLinesAsync(string, Encoding, CancellationToken) reference
  • Task WriteAllBytesAsync(string, byte[], CancellationToken) reference
  • Task WriteAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) reference
  • Task WriteAllLinesAsync(string, IEnumerable<string>, CancellationToken) reference
  • Task WriteAllLinesAsync(string, IEnumerable<string>, Encoding, CancellationToken) reference
  • void WriteAllText(string, ReadOnlySpan<char>, Encoding) reference
  • void WriteAllText(string, ReadOnlySpan<char>) reference
  • Task WriteAllTextAsync(string, string?, CancellationToken) reference
  • Task WriteAllTextAsync(string, string?, Encoding, CancellationToken) reference

FileInfo

FileUnixMode

  • UnixFileMode GetUnixFileMode(string) reference
  • void SetUnixFileMode(string, UnixFileMode) reference

GC

  • T[] AllocateUninitializedArray<T>(int, bool) reference

Guid

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>) reference
  • Guid CreateVersion7() reference
  • Guid CreateVersion7(DateTimeOffset) reference
  • Guid Parse(ReadOnlySpan<byte>) reference
  • bool TryParse(ReadOnlySpan<byte>, Guid) reference
  • bool TryParse(ReadOnlySpan<char>, Guid) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, Guid) reference
  • bool TryParse(string?, IFormatProvider?, Guid) reference
  • bool TryParseExact(ReadOnlySpan<char>, ReadOnlySpan<char>, Guid) reference
  • AllBitsSet reference

HashSet

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • HashSetAlternateLookup<T, TAlternate> GetAlternateLookup<T, TAlternate>() reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
    • Note: Returns the free-standing HashSetAlternateLookup<T, TAlternate> rather than the BCL's nested HashSet<T>.AlternateLookup<TAlternate>. Use var for cross-target code.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryGetAlternateLookup<T, TAlternate>(HashSetAlternateLookup<T, TAlternate>) reference
    • Note: Lookups are O(n) on older targets; the BCL is O(1).
  • bool TryGetValue<T>(T, T) reference

HttpClient

  • Task<byte[]> GetByteArrayAsync(string, CancellationToken) reference
  • Task<byte[]> GetByteArrayAsync(Uri, CancellationToken) reference
  • Task<Stream> GetStreamAsync(string, CancellationToken) reference
  • Task<Stream> GetStreamAsync(Uri, CancellationToken) reference
  • Task<string> GetStringAsync(string, CancellationToken) reference
  • Task<string> GetStringAsync(Uri, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(string?, HttpContent?, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(string?, HttpContent?) reference
  • Task<HttpResponseMessage> PatchAsync(Uri?, HttpContent?, CancellationToken) reference
  • Task<HttpResponseMessage> PatchAsync(Uri?, HttpContent?) reference
  • HttpResponseMessage Send(HttpRequestMessage, CancellationToken) reference
  • HttpResponseMessage Send(HttpRequestMessage, HttpCompletionOption, CancellationToken) reference
  • HttpResponseMessage Send(HttpRequestMessage, HttpCompletionOption) reference
  • HttpResponseMessage Send(HttpRequestMessage) reference

HttpContent

  • void CopyTo(Stream, System.Net.TransportContext?, CancellationToken) reference
  • Task CopyToAsync(Stream, CancellationToken) reference
  • Task CopyToAsync(Stream, System.Net.TransportContext?, CancellationToken) reference
  • Task LoadIntoBufferAsync(CancellationToken) reference
  • Task LoadIntoBufferAsync(long, CancellationToken) reference
  • Task<byte[]> ReadAsByteArrayAsync(CancellationToken) reference
  • Stream ReadAsStream(CancellationToken) reference
  • Task<Stream> ReadAsStreamAsync(CancellationToken) reference
  • Task<string> ReadAsStringAsync(CancellationToken) reference

IDictionary<TKey, TValue>

  • ReadOnlyDictionary<TKey, TValue> AsReadOnly<TKey, TValue>() where TKey : notnull reference
  • bool Remove<TKey, TValue>(TKey, TValue) where TKey : notnull reference
  • bool TryAdd<TKey, TValue>(TKey, TValue) where TKey : notnull reference

IEnumerable<KeyValuePair<TKey, TValue>>

  • Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(IEqualityComparer<TKey>?) where TKey : notnull reference

IEnumerable

  • IOrderedEnumerable<T> Order<T>(IComparer<T>?) reference
  • IOrderedEnumerable<T> Order<T>() reference
  • IOrderedEnumerable<T> OrderDescending<T>(IComparer<T>?) reference
  • IOrderedEnumerable<T> OrderDescending<T>() reference

IEnumerable

  • IEnumerable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst, TSecond, TThird>(IEnumerable<TSecond>, IEnumerable<TThird>) reference
  • IEnumerable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(IEnumerable<TSecond>) reference

IEnumerable

  • IEnumerable<TResult> FullJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner?, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<(TOuter? Outer, TInner? Inner)> FullJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<IGrouping<TOuter, TInner>> GroupJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<(TOuter Outer, TInner Inner)> Join<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter, TInner?, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter, TInner?, TResult>) reference
  • IEnumerable<(TOuter Outer, TInner? Inner)> LeftJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner, TResult>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter?, TInner, TResult>) reference
  • IEnumerable<(TOuter? Outer, TInner Inner)> RightJoin<TOuter, TInner, TKey>(IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, IEqualityComparer<TKey>?) reference

IEnumerable

  • IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(Func<TSource, TKey>, Func<TKey, TAccumulate>, Func<TAccumulate, TSource, TAccumulate>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(Func<TSource, TKey>, TAccumulate, Func<TAccumulate, TSource, TAccumulate>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<TSource> Append<TSource>(TSource) reference
  • IEnumerable<TSource[]> Chunk<TSource>(int) reference
  • IEnumerable<KeyValuePair<TKey, int>> CountBy<TSource, TKey>(Func<TSource, TKey>, IEqualityComparer<TKey>?) where TKey : notnull reference
  • IEnumerable<TSource> DistinctBy<TSource, TKey>(Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> DistinctBy<TSource, TKey>(Func<TSource, TKey>) reference
  • TSource ElementAt<TSource>(Index) reference
  • TSource? ElementAtOrDefault<TSource>(Index) reference
  • IEnumerable<TSource> Except<TSource>(IEqualityComparer<TSource>?, TSource[]) reference
  • IEnumerable<TSource> Except<TSource>(TSource, IEqualityComparer<TSource>?) reference
  • IEnumerable<TSource> Except<TSource>(TSource) reference
  • IEnumerable<TSource> ExceptBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> ExceptBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>) reference
  • TSource FirstOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource FirstOrDefault<TSource>(TSource) reference
  • IEnumerable<(int Index, TSource Item)> Index<TSource>() reference
  • IEnumerable<TSource> IntersectBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> IntersectBy<TSource, TKey>(IEnumerable<TKey>, Func<TSource, TKey>) reference
  • TSource LastOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource LastOrDefault<TSource>(TSource) reference
  • TSource? Max<TSource>(IComparer<TSource>?) reference
  • TSource? MaxBy<TSource, TKey>(Func<TSource, TKey>, IComparer<TKey>?) reference
  • TSource? MaxBy<TSource, TKey>(Func<TSource, TKey>) reference
  • TSource? Min<TSource>(IComparer<TSource>?) reference
  • TSource? MinBy<TSource, TKey>(Func<TSource, TKey>, IComparer<TKey>?) reference
  • TSource? MinBy<TSource, TKey>(Func<TSource, TKey>) reference
  • IEnumerable<TSource> Prepend<TSource>(TSource) reference
  • TSource SingleOrDefault<TSource>(Func<TSource, bool>, TSource) reference
  • TSource SingleOrDefault<TSource>(TSource) reference
  • IEnumerable<TSource> SkipLast<TSource>(int) reference
  • IEnumerable<TSource> Take<TSource>(Range) reference
  • IEnumerable<TSource> TakeLast<TSource>(int) reference
  • HashSet<TSource> ToHashSet<TSource>(IEqualityComparer<TSource>?) reference
  • bool TryGetNonEnumeratedCount<TSource>(int) reference
  • IEnumerable<TSource> UnionBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>?) reference
  • IEnumerable<TSource> UnionBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>) reference

IList

  • ReadOnlyCollection<T> AsReadOnly<T>() reference

Int16

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<byte>, short) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, short) reference
  • bool TryParse(ReadOnlySpan<char>, short) reference
  • bool TryParse(string?, IFormatProvider?, short) reference

Int32

  • float Int32BitsToSingle(int)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<byte>, int) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, int) reference
  • bool TryParse(ReadOnlySpan<char>, int) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, int) reference
  • bool TryParse(string?, IFormatProvider?, int) reference

Int64

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<byte>, long) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, long) reference
  • bool TryParse(ReadOnlySpan<char>, long) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, long) reference
  • bool TryParse(string?, IFormatProvider?, long) reference

Interlocked

IntPtr

  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<byte>, nint) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, nint) reference
  • bool TryParse(ReadOnlySpan<char>, nint) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, nint) reference
  • bool TryParse(string?, IFormatProvider?, nint) reference
  • bool TryParse(string?, nint) reference
  • bool TryParse(string?, NumberStyles, IFormatProvider?, nint) reference

IPAddress

  • IPAddress Parse(ReadOnlySpan<char>) reference
  • bool TryParse(ReadOnlySpan<byte>, IPAddress?) reference
  • bool TryParse(ReadOnlySpan<char>, IPAddress?) reference

IReadOnlyDictionary<TKey, TValue>

  • TValue GetValueOrDefault<TKey, TValue>(TKey, TValue) where TKey : notnull reference
  • TValue? GetValueOrDefault<TKey, TValue>(TKey) reference

ISet

KeyValuePair<TKey, TValue>

  • void Deconstruct<TKey, TValue>(TKey, TValue) reference

List

  • void AddRange<T>(ReadOnlySpan<T>) reference
  • void CopyTo<T>(Span<T>) reference
  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
    • Note: Returns void on older targets; the BCL returns int (the new capacity).
  • void InsertRange<T>(int, ReadOnlySpan<T>) reference
  • void TrimExcess<T>()
    • Note: No-op on older targets; the BCL shrinks the backing storage.

Math

MD5

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

MemberInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool HasSameMetadataDefinitionAs(MemberInfo) reference
  • bool IsNullable()

MethodInfo

  • T CreateDelegate<T>(object?) where T : Delegate reference
  • T CreateDelegate<T>() where T : Delegate reference

ObjectDisposedException

Requires <PolyArgumentExceptions>true</PolyArgumentExceptions> in the consuming project.

OperatingSystem

OrderedDictionary<TKey, TValue>

  • bool TryAdd<TKey, TValue>(TKey, TValue, int) where TKey : notnull reference
  • bool TryGetValue<TKey, TValue>(TKey, TValue, int) where TKey : notnull reference

Parallel

  • Task ForEachAsync<T>(IAsyncEnumerable<T>, CancellationToken, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IAsyncEnumerable<T>, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IAsyncEnumerable<T>, ParallelOptions, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, CancellationToken, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>) reference
  • Task ForEachAsync<T>(IEnumerable<T>, ParallelOptions, Func<T, CancellationToken, ValueTask>) reference

ParameterInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

Path

  • string Combine(ReadOnlySpan<string>) reference
  • bool EndsInDirectorySeparator(ReadOnlySpan<char>) reference
  • bool EndsInDirectorySeparator(string) reference
  • bool Exists(string?) reference
  • ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetExtension(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetFileName(ReadOnlySpan<char>) reference
  • ReadOnlySpan<char> GetFileNameWithoutExtension(ReadOnlySpan<char>) reference
  • string GetRelativePath(string, string) reference
  • bool HasExtension(ReadOnlySpan<char>) reference
  • bool IsPathRooted(ReadOnlySpan<char>) reference
  • string Join(string?[]) reference
  • ReadOnlySpan<char> TrimEndingDirectorySeparator(ReadOnlySpan<char>) reference
  • string TrimEndingDirectorySeparator(string) reference

PriorityQueue<TElement, TPriority>

  • bool Remove<TElement, TPriority>(TElement, TElement, TPriority, IEqualityComparer<TElement>?) reference

Process

  • void Kill(bool) reference
  • (byte[] StandardOutput, byte[] StandardError) ReadAllBytes(TimeSpan?) reference
  • Task<(byte[] StandardOutput, byte[] StandardError)> ReadAllBytesAsync(CancellationToken) reference
  • IAsyncEnumerable<ProcessOutputLine> ReadAllLinesAsync(CancellationToken) reference
  • (string StandardOutput, string StandardError) ReadAllText(TimeSpan?) reference
  • Task<(string StandardOutput, string StandardError)> ReadAllTextAsync(CancellationToken) reference
  • Task WaitForExitAsync(CancellationToken) reference
  • ProcessExitStatus Run(ProcessStartInfo, TimeSpan?) reference
  • ProcessExitStatus Run(string, IList<string>?, bool, TimeSpan?) reference
    • Note: When silent is true, standard output and error are suppressed by redirecting and discarding them (rather than binding to the null device as on net11); standard input remains connected.
  • ProcessTextOutput RunAndCaptureText(ProcessStartInfo, TimeSpan?) reference
  • ProcessTextOutput RunAndCaptureText(string, IList<string>?, TimeSpan?) reference
  • Task<ProcessTextOutput> RunAndCaptureTextAsync(ProcessStartInfo, CancellationToken) reference
  • Task<ProcessTextOutput> RunAndCaptureTextAsync(string, IList<string>?, CancellationToken) reference
  • Task<ProcessExitStatus> RunAsync(ProcessStartInfo, CancellationToken) reference
  • Task<ProcessExitStatus> RunAsync(string, IList<string>?, bool, CancellationToken) reference
    • Note: When silent is true, standard output and error are suppressed by redirecting and discarding them (rather than binding to the null device as on net11); standard input remains connected.
  • int StartAndForget(ProcessStartInfo) reference
  • int StartAndForget(string, IList<string>?) reference
  • bool TryGetProcessById(int, Process?) reference

PropertyInfo

  • NullabilityState GetNullability()
  • NullabilityInfo GetNullabilityInfo()
  • bool IsNullable()

Queue

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryDequeue<T>(T) reference
  • bool TryPeek<T>(T) reference

Random

RandomNumberGenerator

ReadOnlySpan

  • bool EndsWith(string, StringComparison) reference
  • SpanLineEnumerator EnumerateLines() reference
  • int GetNormalizedLength(NormalizationForm) reference
  • bool IsNormalized(NormalizationForm) reference
  • bool SequenceEqual(string) reference
  • int Split(Span<Range>, char, StringSplitOptions) reference
  • int Split(Span<Range>, ReadOnlySpan<char>, StringSplitOptions) reference
  • int SplitAny(Span<Range>, ReadOnlySpan<char>, StringSplitOptions) reference
  • int SplitAny(Span<Range>, ReadOnlySpan<string>, StringSplitOptions) reference
  • bool StartsWith(string, StringComparison) reference
  • bool TryNormalize(Span<char>, int, NormalizationForm) reference

ReadOnlySpan

  • int CommonPrefixLength<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CommonPrefixLength<T>(ReadOnlySpan<T>) reference
  • bool Contains<T>(T, IEqualityComparer<T>?) reference
  • bool Contains<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExceptInRange<T>(T, T) where T : IComparable<T> reference
  • bool ContainsAnyInRange<T>(T, T) where T : IComparable<T> reference
  • int CountAny<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CountAny<T>(ReadOnlySpan<T>) where T : IEquatable<T>? reference
  • int CountAny<T>(SearchValues<T>) where T : IEquatable<T>? reference
  • bool EndsWith<T>(T) where T : IEquatable<T>? reference
  • int IndexOf<T>(T, IEqualityComparer<T>?) reference
  • int IndexOfAny<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int IndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • T? Max<T>(IComparer<T>?) reference
  • T? Max<T>() reference
  • T? Min<T>(IComparer<T>?) reference
  • T? Min<T>() reference
  • SpanSplitEnumerator<T> Split<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> Split<T>(T) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> SplitAny<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • SpanSplitEnumerator<T> SplitAny<T>(SearchValues<T>) where T : IEquatable<T> reference
  • bool StartsWith<T>(T) where T : IEquatable<T>? reference

Regex

  • int Count(ReadOnlySpan<char>, int) reference
  • int Count(ReadOnlySpan<char>) reference
  • int Count(string) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, int) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, int, int) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, int) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>) reference
  • bool IsMatch(ReadOnlySpan<char>, int) reference
  • bool IsMatch(ReadOnlySpan<char>) reference
  • int Count(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • int Count(ReadOnlySpan<char>, string, RegexOptions) reference
  • int Count(ReadOnlySpan<char>, string) reference
  • int Count(string, string, RegexOptions, TimeSpan) reference
  • int Count(string, string, RegexOptions) reference
  • int Count(string, string) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string, RegexOptions) reference
  • ValueMatchEnumerator EnumerateMatches(ReadOnlySpan<char>, string) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string, RegexOptions) reference
  • ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char>, string) reference
  • bool IsMatch(ReadOnlySpan<char>, string, RegexOptions, TimeSpan) reference
  • bool IsMatch(ReadOnlySpan<char>, string, RegexOptions) reference
  • bool IsMatch(ReadOnlySpan<char>, string) reference

RuntimeFeature

SByte

  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<byte>, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, sbyte) reference
  • bool TryParse(ReadOnlySpan<char>, sbyte) reference
  • bool TryParse(string?, IFormatProvider?, sbyte) reference

SHA1

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA256

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA384

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

SHA512

  • byte[] HashData(byte[]) reference
  • int HashData(ReadOnlySpan<byte>, Span<byte>) reference
  • byte[] HashData(ReadOnlySpan<byte>) reference
  • int HashData(Stream, Span<byte>) reference
  • byte[] HashData(Stream) reference
  • ValueTask<byte[]> HashDataAsync(Stream, CancellationToken) reference
  • ValueTask<int> HashDataAsync(Stream, Memory<byte>, CancellationToken) reference
  • bool TryHashData(ReadOnlySpan<byte>, Span<byte>, int) reference

Single

  • int SingleToInt32Bits(float)
  • uint SingleToUInt32Bits(float)
  • bool TryFormat(Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryFormat(Span<char>, int, ReadOnlySpan<char>, IFormatProvider?) reference
  • bool TryParse(ReadOnlySpan<byte>, float) reference
  • bool TryParse(ReadOnlySpan<byte>, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<byte>, NumberStyles, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<char>, float) reference
  • bool TryParse(ReadOnlySpan<char>, IFormatProvider?, float) reference
  • bool TryParse(ReadOnlySpan<char>, NumberStyles, IFormatProvider?, float) reference
  • bool TryParse(string?, IFormatProvider?, float) reference

Socket

  • ValueTask ConnectAsync(EndPoint, CancellationToken) reference
  • ValueTask DisconnectAsync(bool, CancellationToken) reference
  • ValueTask<SocketReceiveFromResult> ReceiveFromAsync(Memory<byte>, SocketFlags, EndPoint, CancellationToken) reference
  • ValueTask<int> SendToAsync(ReadOnlyMemory<byte>, SocketFlags, EndPoint, CancellationToken) reference

SortedList<TKey, TValue>

  • TKey GetKeyAtIndex<TKey, TValue>(int) reference
  • TValue GetValueAtIndex<TKey, TValue>(int) reference

Span

Span

  • int CommonPrefixLength<T>(ReadOnlySpan<T>, IEqualityComparer<T>?) reference
  • int CommonPrefixLength<T>(ReadOnlySpan<T>) reference
  • bool Contains<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • bool ContainsAnyExcept<T>(T) where T : IEquatable<T> reference
  • bool ContainsAnyExceptInRange<T>(T, T) where T : IComparable<T> reference
  • bool ContainsAnyInRange<T>(T, T) where T : IComparable<T> reference
  • int IndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int IndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(ReadOnlySpan<T>) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T, T) where T : IEquatable<T> reference
  • int LastIndexOfAnyExcept<T>(T) where T : IEquatable<T> reference
  • void Sort<T>(Comparison<T>)
  • void Sort<T>() where T : IComparable<T> reference

Span

  • void Sort<TKey, TValue, TComparer>(Span<TValue>, TComparer) where TComparer : IComparer<TKey> reference
  • void Sort<TKey, TValue>(Span<TValue>, Comparison<TKey>) reference
  • void Sort<TKey, TValue>(Span<TValue>) reference

Stack

  • void EnsureCapacity<T>(int) reference
    • Note: No-op on older targets; the BCL grows the backing storage.
  • void TrimExcess<T>(int) reference
    • Note: No-op on older targets; the BCL shrinks the backing storage.
  • bool TryPeek<T>(T) reference
  • bool TryPop<T>(T) reference

Stopwatch

Stream

  • Task CopyToAsync(Stream, CancellationToken) reference
  • ValueTask DisposeAsync() reference
  • int Read(Span<byte>) reference
  • ValueTask<int> ReadAsync(Memory<byte>, CancellationToken) reference
  • int ReadAtLeast(Span<byte>, int, bool) reference
  • ValueTask<int> ReadAtLeastAsync(Memory<byte>, int, bool, CancellationToken) reference
  • void ReadExactly(byte[], int, int) reference
  • void ReadExactly(Span<byte>) reference
  • ValueTask ReadExactlyAsync(byte[], int, int, CancellationToken) reference
  • ValueTask ReadExactlyAsync(Memory<byte>, CancellationToken) reference
  • void Write(ReadOnlySpan<byte>) reference
  • ValueTask WriteAsync(ReadOnlyMemory<byte>, CancellationToken) reference

String

  • bool Contains(char, StringComparison) reference
  • bool Contains(char) reference
  • bool Contains(string, StringComparison) reference
  • void CopyTo(Span<char>) reference
  • bool EndsWith(char, StringComparison) reference
  • bool EndsWith(char) reference
  • int GetHashCode(StringComparison) reference
  • int IndexOf(char, int, int, StringComparison) reference
  • int IndexOf(char, int, StringComparison) reference
  • int IndexOf(char, StringComparison) reference
  • int LastIndexOf(char, int, int, StringComparison) reference
  • int LastIndexOf(char, int, StringComparison) reference
  • int LastIndexOf(char, StringComparison) reference
  • string ReplaceLineEndings(string) reference
  • string ReplaceLineEndings() reference
  • string[] Split(char, int, StringSplitOptions) reference
  • string[] Split(char, StringSplitOptions) reference
  • string[] Split(string, int, StringSplitOptions) reference
  • string[] Split(string, StringSplitOptions) reference
  • bool StartsWith(char, StringComparison) reference
  • bool StartsWith(char) reference
  • bool TryCopyTo(Span<char>) reference
  • string Concat(ReadOnlySpan<object?>) reference
  • string Concat(ReadOnlySpan<string?>) reference
  • string Create<TState>(int, TState, System.Buffers.SpanAction<char, TState>) reference
  • int GetHashCode(ReadOnlySpan<char>, StringComparison) reference
  • int GetHashCode(ReadOnlySpan<char>) reference
  • string Join(char, object?[]) reference
  • string Join(char, ReadOnlySpan<object?>) reference
  • string Join(char, ReadOnlySpan<string?>) reference
  • string Join(char, string?[], int, int) reference
  • string Join(char, string?[]) reference
  • string Join(string?, ReadOnlySpan<object?>) reference
  • string Join(string?, ReadOnlySpan<string?>) reference
  • string Join<T>(char, IEnumerable<T>) reference

StringBuilder

  • StringBuilder Append(StringBuilder, AppendInterpolatedStringHandler) reference
  • StringBuilder Append(StringBuilder, IFormatProvider?, AppendInterpolatedStringHandler) reference
  • StringBuilder Append(StringBuilder, IFormatProvider?, StringBuilder.AppendInterpolatedStringHandler) reference
  • `S

Truncated — view the full README on GitHub.

Contributors

(top 30 of 38)

SimonCropp

1,963 commits

dependabot[bot]

39 commits

pengweiqhca

9 commits

alastairlundy

7 commits

Languages

C#

100.0%