Skip to content

Commit 7684d0e

Browse files
authored
Add DateOnly Deconstruct (#327)
1 parent b5b71f8 commit 7684d0e

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

apiCount.include.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
**API count: 573**
1+
**API count: 574**

api_list.include.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#### DateOnly
4242

43+
* `void Deconstruct(DateOnly, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.deconstruct)
4344
* `bool TryFormat(DateOnly, Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.tryformat#system-dateonly-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
4445
* `bool TryFormat(DateOnly, Span<char>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.tryformat#system-dateonly-tryformat(system-span((system-char))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
4546

readme.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The package targets `netstandard2.0` and is designed to support the following ru
1212
* `net5.0`, `net6.0`, `net7.0`, `net8.0`, `net9.0`, `net10.0`
1313

1414

15-
**API count: 573**<!-- singleLineInclude: apiCount. path: /apiCount.include.md -->
15+
**API count: 574**<!-- singleLineInclude: apiCount. path: /apiCount.include.md -->
1616

1717

1818
**See [Milestones](../../milestones?state=closed) for release notes.**
@@ -509,6 +509,7 @@ The class `Polyfill` includes the following extension methods:
509509

510510
#### DateOnly
511511

512+
* `void Deconstruct(DateOnly, int, int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.deconstruct)
512513
* `bool TryFormat(DateOnly, Span<byte>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.tryformat#system-dateonly-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
513514
* `bool TryFormat(DateOnly, Span<char>, int, ReadOnlySpan<char>, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.tryformat#system-dateonly-tryformat(system-span((system-char))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider))
514515

src/Polyfill/Polyfill_DateOnly.cs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// <auto-generated />
2+
3+
#pragma warning disable
4+
5+
namespace Polyfills;
6+
7+
using System;
8+
using System.Collections.Generic;
9+
using System.ComponentModel;
10+
11+
static partial class Polyfill
12+
{
13+
#if NET6_0 || NET7_0
14+
/// <summary>
15+
/// Deconstructs DateOnly by Year, Month, and Day.
16+
/// </summary>
17+
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.dateonly.deconstruct
18+
[EditorBrowsable(EditorBrowsableState.Never)]
19+
public static void Deconstruct(this DateOnly target, out int year, out int month, out int day)
20+
{
21+
year = target.Year;
22+
month = target.Month;
23+
day = target.Day;
24+
}
25+
#endif
26+
27+
}

0 commit comments

Comments
 (0)