diff --git a/Extensions b/Extensions index e9ed863..26d6985 160000 --- a/Extensions +++ b/Extensions @@ -1 +1 @@ -Subproject commit e9ed8637e3df9c142136ba64b8f1e7b11e44f85c +Subproject commit 26d6985fccb345f1f3bce799953bf046e01b0d86 diff --git a/System.Polyfills/System.Polyfills.props b/System.Polyfills/System.Polyfills.props new file mode 100644 index 0000000..c6dfb7f --- /dev/null +++ b/System.Polyfills/System.Polyfills.props @@ -0,0 +1,7 @@ + + + + + + + diff --git a/System.Polyfills/System.Polyfills.targets b/System.Polyfills/System.Polyfills.targets index 9827214..dbe15fb 100644 --- a/System.Polyfills/System.Polyfills.targets +++ b/System.Polyfills/System.Polyfills.targets @@ -7,10 +7,6 @@ $(DefineConstants);NOTNETSTANDARD21ORGREATER $(DefineConstants);NOTNETSTANDARD20ORGREATER - - - - diff --git a/System.Polyfills/System.Runtime.CompilerServices/IsExternalInit.cs b/System.Polyfills/System.Runtime.CompilerServices/IsExternalInit.cs index 9f5c449..a793654 100644 --- a/System.Polyfills/System.Runtime.CompilerServices/IsExternalInit.cs +++ b/System.Polyfills/System.Runtime.CompilerServices/IsExternalInit.cs @@ -1,16 +1,25 @@ -#if !NET6_0_OR_GREATER +#if NET5_0_OR_GREATER + +[assembly: System.Runtime.CompilerServices.TypeForwardedTo( + typeof(System.Runtime.CompilerServices.IsExternalInit) +)] + +#else + // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using System.ComponentModel; -namespace System.Runtime.CompilerServices -{ - /// - /// Reserved to be used by the compiler for tracking metadata. This class - /// should not be used by developers in source code. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public static class IsExternalInit { } -} +namespace System.Runtime.CompilerServices; + +// https://github.com/dotnet/runtime/blob/v8.0.0/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/IsExternalInit.cs + +/// +/// Reserved to be used by the compiler for tracking metadata. +/// This class should not be used by developers in source code. +/// +[EditorBrowsable(EditorBrowsableState.Never)] +public // polyfill! +static class IsExternalInit { } + #endif diff --git a/System.Polyfills/System/DateOnly.cs b/System.Polyfills/System/DateOnly.cs index e84226b..e955060 100644 --- a/System.Polyfills/System/DateOnly.cs +++ b/System.Polyfills/System/DateOnly.cs @@ -400,7 +400,7 @@ public static DateOnly Parse( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None ) @@ -419,7 +419,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -436,7 +436,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -479,7 +479,7 @@ public static DateOnly Parse( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None ) @@ -500,7 +500,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -517,7 +517,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -565,7 +565,7 @@ public static DateOnly Parse( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format + [@StringSyntax(StringSyntax.DateOnlyFormat)] string format ) => ParseExact(s, format, null, DateTimeStyles.None); /// @@ -582,7 +582,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] string format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -601,7 +601,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -618,7 +618,7 @@ public static DateOnly ParseExact( /// does not contain a valid string representation of a date. public static DateOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.DateOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -686,7 +686,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, out DateOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -707,7 +707,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result @@ -731,7 +731,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, out DateOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -752,7 +752,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -821,7 +821,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, out DateOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -842,7 +842,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result @@ -872,7 +872,7 @@ out var dateTime /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, out DateOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -893,7 +893,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -963,7 +963,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string? format, + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string? format, out DateOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -983,7 +983,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string? format, + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out DateOnly result @@ -1006,7 +1006,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, out DateOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -1026,7 +1026,7 @@ out DateOnly result /// otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.DateOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -1063,7 +1063,7 @@ out DateOnly result /// A standard or custom date format string. /// A string representation of value of the current object as specified by . public string ToString( - [@StringSyntax(@StringSyntaxAttribute.DateOnlyFormat)] string? format + [@StringSyntax(StringSyntax.DateOnlyFormat)] string? format ) { if (string.IsNullOrEmpty(format)) @@ -1089,7 +1089,7 @@ public string ToString( /// An object that supplies culture-specific formatting information. /// A string representation of value of the current object as specified by format and provider. public string ToString( - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] string? format, + [@StringSyntax(StringSyntax.DateOnlyFormat)] string? format, IFormatProvider? provider ) { @@ -1117,7 +1117,7 @@ public string ToString( public bool TryFormat( Span destination, out int charsWritten, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format = default(ReadOnlySpan), IFormatProvider? provider = null ) @@ -1144,7 +1144,7 @@ public bool TryFormat( public bool TryFormat( Span destination, out int charsWritten, - [@StringSyntax(StringSyntaxAttribute.DateOnlyFormat)] + [@StringSyntax(StringSyntax.DateOnlyFormat)] ReadOnlySpan format = default(ReadOnlySpan), IFormatProvider? provider = null ) diff --git a/System.Polyfills/System/TimeOnly.cs b/System.Polyfills/System/TimeOnly.cs index 478cd4c..90cd239 100644 --- a/System.Polyfills/System/TimeOnly.cs +++ b/System.Polyfills/System/TimeOnly.cs @@ -481,7 +481,7 @@ public static TimeOnly Parse( /// as specified by , and . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None ) @@ -499,7 +499,7 @@ public static TimeOnly ParseExact( /// as specified by one of . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -515,7 +515,7 @@ public static TimeOnly ParseExact( /// as specified by , , and one of . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -555,7 +555,7 @@ public static TimeOnly Parse( /// as specified by , and . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider = default, DateTimeStyles style = DateTimeStyles.None ) @@ -575,7 +575,7 @@ public static TimeOnly ParseExact( /// as specified by one of . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -591,7 +591,7 @@ public static TimeOnly ParseExact( /// as specified by , , and one of . public static TimeOnly ParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -637,7 +637,7 @@ public static TimeOnly Parse( /// as specified by . public static TimeOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string format ) => ParseExact(s, format, null, DateTimeStyles.None); /// @@ -655,7 +655,7 @@ public static TimeOnly ParseExact( /// as specified by , and . public static TimeOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string format, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -673,7 +673,7 @@ public static TimeOnly ParseExact( /// as specified by one of . public static TimeOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats ) => ParseExact(s, formats, null, DateTimeStyles.None); /// @@ -689,7 +689,7 @@ public static TimeOnly ParseExact( /// as specified by , , and one of . public static TimeOnly ParseExact( string s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string[] formats, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string[] formats, IFormatProvider? provider, DateTimeStyles style = DateTimeStyles.None ) @@ -751,7 +751,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, out TimeOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -770,7 +770,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result @@ -792,7 +792,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, out TimeOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -811,7 +811,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -874,7 +874,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, out TimeOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -893,7 +893,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result @@ -921,7 +921,7 @@ out var dateTime /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, out TimeOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -940,7 +940,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( ReadOnlySpan s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -1007,7 +1007,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format, + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string? format, out TimeOnly result ) => TryParseExact(s, format, null, DateTimeStyles.None, out result); @@ -1026,7 +1026,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format, + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string? format, IFormatProvider? provider, DateTimeStyles style, out TimeOnly result @@ -1048,7 +1048,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, out TimeOnly result ) => TryParseExact(s, formats, null, DateTimeStyles.None, out result); @@ -1067,7 +1067,7 @@ out TimeOnly result /// if the parameter was converted successfully; otherwise, . public static bool TryParseExact( [NotNullWhen(true)] string? s, - [NotNullWhen(true), @StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [NotNullWhen(true), @StringSyntax(StringSyntax.TimeOnlyFormat)] string?[]? formats, IFormatProvider? provider, DateTimeStyles style, @@ -1104,7 +1104,7 @@ out TimeOnly result /// A standard or custom time format string. /// A string representation of value of the current object as specified by . /// The accepted standard formats are 'r', 'R', 'o', 'O', 't' and 'T'. - public string ToString([@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format) + public string ToString([@StringSyntax(StringSyntax.TimeOnlyFormat)] string? format) { if (string.IsNullOrEmpty(format)) { @@ -1131,7 +1131,7 @@ public string ToString([@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] str /// as specified by and . /// The accepted standard formats are 'r', 'R', 'o', 'O', 't' and 'T'. public string ToString( - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] string? format, + [@StringSyntax(StringSyntax.TimeOnlyFormat)] string? format, IFormatProvider? provider ) { @@ -1160,7 +1160,7 @@ public string ToString( public bool TryFormat( Span destination, out int charsWritten, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format = default(ReadOnlySpan), IFormatProvider? provider = null ) @@ -1187,7 +1187,7 @@ public bool TryFormat( public bool TryFormat( Span destination, out int charsWritten, - [@StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] + [@StringSyntax(StringSyntax.TimeOnlyFormat)] ReadOnlySpan format = default(ReadOnlySpan), IFormatProvider? provider = null )