Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apiCount.include.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**API count: 1147**
**API count: 1150**

### Per Target Framework

Expand All @@ -19,10 +19,10 @@
| `netcoreapp3.0` | 859 |
| `netcoreapp3.1` | 858 |
| `net5.0` | 736 |
| `net6.0` | 629 |
| `net7.0` | 488 |
| `net8.0` | 367 |
| `net9.0` | 238 |
| `net6.0` | 632 |
| `net7.0` | 491 |
| `net8.0` | 370 |
| `net9.0` | 241 |
| `net10.0` | 182 |
| `net11.0` | 58 |
| `uap10.0` | 1044 |
10 changes: 10 additions & 0 deletions api_list.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,16 @@
* `ReadOnlySet<T> AsReadOnly<T>()` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.collectionextensions.asreadonly?view=net-11.0#system-collections-generic-collectionextensions-asreadonly-1(system-collections-generic-iset((-0))))


#### ISOWeek

* `int GetWeekOfYear(DateOnly)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getweekofyear?view=net-11.0#system-globalization-isoweek-getweekofyear(system-dateonly))
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.
* `int GetYear(DateOnly)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getyear?view=net-11.0#system-globalization-isoweek-getyear(system-dateonly))
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.
* `DateOnly ToDateOnly(int, int, DayOfWeek)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.todateonly?view=net-11.0)
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.


#### KeyValuePair<TKey, TValue>

* `void Deconstruct<TKey, TValue>(TKey, TValue)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2.deconstruct?view=net-11.0)
Expand Down
16 changes: 8 additions & 8 deletions assemblySize.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
| netcoreapp3.0 | 9.5KB | 326.5KB | +317.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB |
| netcoreapp3.1 | 9.5KB | 324.5KB | +315.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
| net5.0 | 9.5KB | 290.0KB | +280.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
| net6.0 | 10.0KB | 230.0KB | +220.0KB | +10.0KB | +7.0KB | +1.0KB | +3.5KB |
| net7.0 | 10.0KB | 199.0KB | +189.0KB | +9.0KB | +5.5KB | +512bytes | +3.0KB |
| net8.0 | 9.5KB | 168.5KB | +159.0KB | +8.5KB | +512bytes | +1.0KB | +3.5KB |
| net9.0 | 9.5KB | 116.0KB | +106.5KB | +8.0KB | | +512bytes | +3.0KB |
| net6.0 | 10.0KB | 231.0KB | +221.0KB | +9.5KB | +6.5KB | +512bytes | +3.5KB |
| net7.0 | 10.0KB | 199.5KB | +189.5KB | +9.5KB | +5.5KB | +512bytes | +3.5KB |
| net8.0 | 9.5KB | 169.5KB | +160.0KB | +8.5KB | | +512bytes | +3.5KB |
| net9.0 | 9.5KB | 116.5KB | +107.0KB | +8.5KB | | +512bytes | +3.5KB |
| net10.0 | 10.0KB | 93.5KB | +83.5KB | +8.5KB | | +512bytes | +3.0KB |
| net11.0 | 10.0KB | 21.0KB | +11.0KB | +9.0KB | | +512bytes | +3.5KB |

Expand All @@ -44,9 +44,9 @@
| netcoreapp3.0 | 9.5KB | 470.3KB | +460.8KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB |
| netcoreapp3.1 | 9.5KB | 468.3KB | +458.8KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
| net5.0 | 9.5KB | 416.3KB | +406.8KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
| net6.0 | 10.0KB | 335.8KB | +325.8KB | +17.7KB | +8.7KB | +1.6KB | +4.2KB |
| net7.0 | 10.0KB | 287.9KB | +277.9KB | +16.6KB | +6.9KB | +1.1KB | +3.7KB |
| net8.0 | 9.5KB | 243.6KB | +234.1KB | +16.0KB | +811bytes | +1.6KB | +4.2KB |
| net9.0 | 9.5KB | 167.6KB | +158.1KB | +15.5KB | | +1.1KB | +3.7KB |
| net6.0 | 10.0KB | 337.2KB | +327.2KB | +17.2KB | +8.2KB | +1.1KB | +4.2KB |
| net7.0 | 10.0KB | 288.8KB | +278.8KB | +17.1KB | +6.9KB | +1.1KB | +4.2KB |
| net8.0 | 9.5KB | 245.0KB | +235.5KB | +16.0KB | +299bytes | +1.1KB | +4.2KB |
| net9.0 | 9.5KB | 168.5KB | +159.0KB | +16.0KB | | +1.1KB | +4.2KB |
| net10.0 | 10.0KB | 136.1KB | +126.1KB | +16.0KB | | +1.1KB | +3.7KB |
| net11.0 | 10.0KB | 30.9KB | +20.9KB | +16.5KB | | +1.1KB | +4.2KB |
40 changes: 25 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The package targets `netstandard2.0` and is designed to support the following ru
* `uap10`


**API count: 1147**<!-- include: apiCount. path: /apiCount.include.md -->
**API count: 1150**<!-- include: apiCount. path: /apiCount.include.md -->

### Per Target Framework

Expand All @@ -34,10 +34,10 @@ The package targets `netstandard2.0` and is designed to support the following ru
| `netcoreapp3.0` | 859 |
| `netcoreapp3.1` | 858 |
| `net5.0` | 736 |
| `net6.0` | 629 |
| `net7.0` | 488 |
| `net8.0` | 367 |
| `net9.0` | 238 |
| `net6.0` | 632 |
| `net7.0` | 491 |
| `net8.0` | 370 |
| `net9.0` | 241 |
| `net10.0` | 182 |
| `net11.0` | 58 |
| `uap10.0` | 1044 |
Expand Down Expand Up @@ -111,10 +111,10 @@ This project uses features from the newest stable SDK and C# language. As such c
| netcoreapp3.0 | 9.5KB | 326.5KB | +317.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB |
| netcoreapp3.1 | 9.5KB | 324.5KB | +315.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
| net5.0 | 9.5KB | 290.0KB | +280.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB |
| net6.0 | 10.0KB | 230.0KB | +220.0KB | +10.0KB | +7.0KB | +1.0KB | +3.5KB |
| net7.0 | 10.0KB | 199.0KB | +189.0KB | +9.0KB | +5.5KB | +512bytes | +3.0KB |
| net8.0 | 9.5KB | 168.5KB | +159.0KB | +8.5KB | +512bytes | +1.0KB | +3.5KB |
| net9.0 | 9.5KB | 116.0KB | +106.5KB | +8.0KB | | +512bytes | +3.0KB |
| net6.0 | 10.0KB | 231.0KB | +221.0KB | +9.5KB | +6.5KB | +512bytes | +3.5KB |
| net7.0 | 10.0KB | 199.5KB | +189.5KB | +9.5KB | +5.5KB | +512bytes | +3.5KB |
| net8.0 | 9.5KB | 169.5KB | +160.0KB | +8.5KB | | +512bytes | +3.5KB |
| net9.0 | 9.5KB | 116.5KB | +107.0KB | +8.5KB | | +512bytes | +3.5KB |
| net10.0 | 10.0KB | 93.5KB | +83.5KB | +8.5KB | | +512bytes | +3.0KB |
| net11.0 | 10.0KB | 21.0KB | +11.0KB | +9.0KB | | +512bytes | +3.5KB |

Expand All @@ -138,10 +138,10 @@ This project uses features from the newest stable SDK and C# language. As such c
| netcoreapp3.0 | 9.5KB | 470.3KB | +460.8KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB |
| netcoreapp3.1 | 9.5KB | 468.3KB | +458.8KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
| net5.0 | 9.5KB | 416.3KB | +406.8KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB |
| net6.0 | 10.0KB | 335.8KB | +325.8KB | +17.7KB | +8.7KB | +1.6KB | +4.2KB |
| net7.0 | 10.0KB | 287.9KB | +277.9KB | +16.6KB | +6.9KB | +1.1KB | +3.7KB |
| net8.0 | 9.5KB | 243.6KB | +234.1KB | +16.0KB | +811bytes | +1.6KB | +4.2KB |
| net9.0 | 9.5KB | 167.6KB | +158.1KB | +15.5KB | | +1.1KB | +3.7KB |
| net6.0 | 10.0KB | 337.2KB | +327.2KB | +17.2KB | +8.2KB | +1.1KB | +4.2KB |
| net7.0 | 10.0KB | 288.8KB | +278.8KB | +17.1KB | +6.9KB | +1.1KB | +4.2KB |
| net8.0 | 9.5KB | 245.0KB | +235.5KB | +16.0KB | +299bytes | +1.1KB | +4.2KB |
| net9.0 | 9.5KB | 168.5KB | +159.0KB | +16.0KB | | +1.1KB | +4.2KB |
| net10.0 | 10.0KB | 136.1KB | +126.1KB | +16.0KB | | +1.1KB | +3.7KB |
| net11.0 | 10.0KB | 30.9KB | +20.9KB | +16.5KB | | +1.1KB | +4.2KB |
<!-- endInclude -->
Expand Down Expand Up @@ -1342,6 +1342,16 @@ The class `Polyfill` includes the following extension methods:
* `ReadOnlySet<T> AsReadOnly<T>()` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.collectionextensions.asreadonly?view=net-11.0#system-collections-generic-collectionextensions-asreadonly-1(system-collections-generic-iset((-0))))


#### ISOWeek

* `int GetWeekOfYear(DateOnly)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getweekofyear?view=net-11.0#system-globalization-isoweek-getweekofyear(system-dateonly))
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.
* `int GetYear(DateOnly)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getyear?view=net-11.0#system-globalization-isoweek-getyear(system-dateonly))
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.
* `DateOnly ToDateOnly(int, int, DayOfWeek)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.todateonly?view=net-11.0)
* Note: Only available on net6.0 and later, since DateOnly does not exist below that.


#### KeyValuePair<TKey, TValue>

* `void Deconstruct<TKey, TValue>(TKey, TValue)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2.deconstruct?view=net-11.0)
Expand Down Expand Up @@ -2549,7 +2559,7 @@ void ObjectDisposedExceptionExample(bool isDisposed)
ObjectDisposedException.ThrowIf(isDisposed, typeof(Consume));
}
```
<sup><a href='/src/Consume/Consume.cs#L919-L943' title='Snippet source file'>snippet source</a> | <a href='#snippet-ArgumentExceptionUsage' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Consume/Consume.cs#L929-L953' title='Snippet source file'>snippet source</a> | <a href='#snippet-ArgumentExceptionUsage' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -2568,7 +2578,7 @@ void EnsureExample(Order order, Customer customer, string customerId, string ema
this.quantity = Ensure.NotNegativeOrZero(quantity);
}
```
<sup><a href='/src/Consume/Consume.cs#L949-L961' title='Snippet source file'>snippet source</a> | <a href='#snippet-EnsureUsage' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Consume/Consume.cs#L959-L971' title='Snippet source file'>snippet source</a> | <a href='#snippet-EnsureUsage' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
10 changes: 10 additions & 0 deletions src/Consume/Consume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@ void BitConverter_Span_Methods()
}
#endif

#if NET6_0_OR_GREATER
void ISOWeek_DateOnly_Methods()
{
var date = new DateOnly(2024, 1, 1);
var week = ISOWeek.GetWeekOfYear(date);
var year = ISOWeek.GetYear(date);
date = ISOWeek.ToDateOnly(year, week, DayOfWeek.Monday);
}
#endif

#if NET5_0_OR_GREATER
void BitConverter_Half_Methods()
{
Expand Down
38 changes: 38 additions & 0 deletions src/Polyfill/ISOWeekPolyfill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#if NET6_0_OR_GREATER && !NET10_0_OR_GREATER

namespace Polyfills;

using System;
using System.Globalization;

static partial class Polyfill
{
extension(ISOWeek)
{
/// <summary>
/// Calculates the ISO week number of a given date.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getweekofyear?view=net-11.0#system-globalization-isoweek-getweekofyear(system-dateonly)
//Note: Only available on net6.0 and later, since DateOnly does not exist below that.
public static int GetWeekOfYear(DateOnly date) =>
ISOWeek.GetWeekOfYear(date.ToDateTime(TimeOnly.MinValue));

/// <summary>
/// Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input date.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.getyear?view=net-11.0#system-globalization-isoweek-getyear(system-dateonly)
//Note: Only available on net6.0 and later, since DateOnly does not exist below that.
public static int GetYear(DateOnly date) =>
ISOWeek.GetYear(date.ToDateTime(TimeOnly.MinValue));

/// <summary>
/// Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent <see cref="DateOnly"/>.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.isoweek.todateonly?view=net-11.0
//Note: Only available on net6.0 and later, since DateOnly does not exist below that.
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) =>
DateOnly.FromDateTime(ISOWeek.ToDateTime(year, week, dayOfWeek));
}
}

#endif
26 changes: 26 additions & 0 deletions src/Split/net6.0/ISOWeekPolyfill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// <auto-generated />
#pragma warning disable
namespace Polyfills;
using System;
using System.Globalization;
static partial class Polyfill
{
extension(ISOWeek)
{
/// <summary>
/// Calculates the ISO week number of a given date.
/// </summary>
public static int GetWeekOfYear(DateOnly date) =>
ISOWeek.GetWeekOfYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input date.
/// </summary>
public static int GetYear(DateOnly date) =>
ISOWeek.GetYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent <see cref="DateOnly"/>.
/// </summary>
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) =>
DateOnly.FromDateTime(ISOWeek.ToDateTime(year, week, dayOfWeek));
}
}
26 changes: 26 additions & 0 deletions src/Split/net7.0/ISOWeekPolyfill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// <auto-generated />
#pragma warning disable
namespace Polyfills;
using System;
using System.Globalization;
static partial class Polyfill
{
extension(ISOWeek)
{
/// <summary>
/// Calculates the ISO week number of a given date.
/// </summary>
public static int GetWeekOfYear(DateOnly date) =>
ISOWeek.GetWeekOfYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input date.
/// </summary>
public static int GetYear(DateOnly date) =>
ISOWeek.GetYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent <see cref="DateOnly"/>.
/// </summary>
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) =>
DateOnly.FromDateTime(ISOWeek.ToDateTime(year, week, dayOfWeek));
}
}
26 changes: 26 additions & 0 deletions src/Split/net8.0/ISOWeekPolyfill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// <auto-generated />
#pragma warning disable
namespace Polyfills;
using System;
using System.Globalization;
static partial class Polyfill
{
extension(ISOWeek)
{
/// <summary>
/// Calculates the ISO week number of a given date.
/// </summary>
public static int GetWeekOfYear(DateOnly date) =>
ISOWeek.GetWeekOfYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input date.
/// </summary>
public static int GetYear(DateOnly date) =>
ISOWeek.GetYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent <see cref="DateOnly"/>.
/// </summary>
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) =>
DateOnly.FromDateTime(ISOWeek.ToDateTime(year, week, dayOfWeek));
}
}
26 changes: 26 additions & 0 deletions src/Split/net9.0/ISOWeekPolyfill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// <auto-generated />
#pragma warning disable
namespace Polyfills;
using System;
using System.Globalization;
static partial class Polyfill
{
extension(ISOWeek)
{
/// <summary>
/// Calculates the ISO week number of a given date.
/// </summary>
public static int GetWeekOfYear(DateOnly date) =>
ISOWeek.GetWeekOfYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input date.
/// </summary>
public static int GetYear(DateOnly date) =>
ISOWeek.GetYear(date.ToDateTime(TimeOnly.MinValue));
/// <summary>
/// Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent <see cref="DateOnly"/>.
/// </summary>
public static DateOnly ToDateOnly(int year, int week, DayOfWeek dayOfWeek) =>
DateOnly.FromDateTime(ISOWeek.ToDateTime(year, week, dayOfWeek));
}
}
Loading
Loading