-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add date, time, and keyValue Deconstruct
- Loading branch information
1 parent
d4ae5bd
commit bf26c5c
Showing
8 changed files
with
148 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
**API count: 513** | ||
**API count: 520** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
namespace Polyfills; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
static partial class Polyfill | ||
{ | ||
#if NET6_0 || NET7_0 | ||
/// <summary> | ||
/// Deconstructs this <see cref="DateTime"/> instance by <see cref="DateOnly"/> and <see cref="TimeOnly"/>. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.datetime.deconstruct#system-datetime-deconstruct(system-dateonly@-system-timeonly@) | ||
public static void Deconstruct(this DateTime target, out DateOnly date, out TimeOnly time) | ||
{ | ||
date = DateOnly.FromDateTime(target); | ||
time = TimeOnly.FromDateTime(target); | ||
} | ||
#endif | ||
|
||
#if !NET8_0_OR_GREATER | ||
/// <summary> | ||
/// Deconstructs <see cref="DateOnly"/> by <see cref="Year"/>, <see cref="Month"/> and <see cref="Day"/>. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.datetime.deconstruct#system-datetime-deconstruct(system-int32@-system-int32@-system-int32@) | ||
public static void Deconstruct(this DateTime target, out int year, out int month, out int day) | ||
{ | ||
year = target.Year; | ||
month = target.Month; | ||
day = target.Day; | ||
} | ||
#endif | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
namespace Polyfills; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
static partial class Polyfill | ||
{ | ||
#if NET6_0 || NET7_0 | ||
/// <summary> | ||
/// Deconstructs this <see cref="DateTimeOffset"/> instance by <see cref="DateOnly"/>, <see cref="TimeOnly"/>, and <see cref="TimeSpan"/>. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.deconstruct?view=net-9.0#definition | ||
public static void Deconstruct(this DateTimeOffset target, out DateOnly date, out TimeOnly time, out TimeSpan offset) | ||
{ | ||
date = DateOnly.FromDateTime(target.DateTime); | ||
time = TimeOnly.FromDateTime(target.DateTime); | ||
|
||
offset = target.Offset; | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// <auto-generated /> | ||
#pragma warning disable | ||
|
||
namespace Polyfills; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
static partial class Polyfill | ||
{ | ||
#if NET7_0 | ||
|
||
/// <summary> | ||
/// Deconstructs this TimeOnly instance. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timeonly.deconstruct#system-timeonly-deconstruct(system-int32@-system-int32@-system-int32@-system-int32@-system-int32@) | ||
public static void Deconstruct(this TimeOnly target, out int hour, out int minute, out int second, out int millisecond, out int microsecond) | ||
{ | ||
hour = target.Hour; | ||
minute = target.Minute; | ||
second = target.Second; | ||
millisecond = target.Millisecond; | ||
microsecond = target.Microsecond; | ||
} | ||
#endif | ||
|
||
#if NET6_0 || NET7_0 | ||
/// <summary> | ||
/// Deconstructs this TimeOnly instance. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timeonly.deconstruct#system-timeonly-deconstruct(system-int32@-system-int32@-system-int32@-system-int32@) | ||
public static void Deconstruct(this TimeOnly target, out int hour, out int minute, out int second, out int millisecond) | ||
{ | ||
hour = target.Hour; | ||
minute = target.Minute; | ||
second = target.Second; | ||
millisecond = target.Millisecond; | ||
} | ||
|
||
/// <summary> | ||
/// Deconstructs this TimeOnly instance. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timeonly.deconstruct#system-timeonly-deconstruct(system-int32@-system-int32@-system-int32@) | ||
public static void Deconstruct(this TimeOnly target, out int hour, out int minute, out int second) | ||
{ | ||
hour = target.Hour; | ||
minute = target.Minute; | ||
second = target.Second; | ||
} | ||
|
||
/// <summary> | ||
/// Deconstructs this TimeOnly instance. | ||
/// </summary> | ||
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.timeonly.deconstruct#system-timeonly-deconstruct(system-int32@-system-int32@) | ||
public static void Deconstruct(this TimeOnly target, out int hour, out int minute) | ||
{ | ||
hour = target.Hour; | ||
minute = target.Minute; | ||
} | ||
#endif | ||
} |