Skip to content

Commit 7411ad9

Browse files
CopilotBillWagner
andauthored
Add NOTE callout about DateTime calculation limitations in default interface methods tutorial (#47311)
* Initial plan * Add NOTE callout about DateTime calculation limitations Co-authored-by: BillWagner <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BillWagner <[email protected]>
1 parent aae38d8 commit 7411ad9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/csharp/advanced-topics/interface-implementation/default-interface-methods-versions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ First, add the new method to the interface, including the body of the method:
4747

4848
:::code language="csharp" source="./snippets/default-interface-members-versions/finished/customer-relationship/ICustomer.cs" id="SnippetLoyaltyDiscountVersionOne":::
4949

50+
> [!NOTE]
51+
> The preceding example uses `DateTime.Now.AddYears(-2)` for simplicity in this tutorial. Be aware that `DateTime` calculations can have edge cases with daylight saving time transitions and leap years. For production code, consider using UTC time or more robust date calculation approaches when precision is important.
52+
5053
The library author wrote a first test to check the implementation:
5154

5255
:::code language="csharp" source="./snippets/default-interface-members-versions/finished/customer-relationship/Program.cs" id="SnippetTestDefaultImplementation":::

0 commit comments

Comments
 (0)