Fix TimeSpan example: incorrect output and logic bug#51535
Merged
meaghanlewis merged 4 commits intomainfrom Feb 6, 2026
Merged
Fix TimeSpan example: incorrect output and logic bug#51535meaghanlewis merged 4 commits intomainfrom
meaghanlewis merged 4 commits intomainfrom
Conversation
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix time conflict in TimeSpan example output
Fix TimeSpan example: incorrect output and logic bug
Feb 5, 2026
Contributor
|
@copilot please add a .vbproj (Visual Basic project file) in the samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.choosingdates/vb/ directory. |
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a TimeSpan structure example that had incorrect expected output and a logic bug. The example demonstrates using TimeSpan to represent store opening hours (8:00-21:30).
Changes:
- Corrected Visual Basic expected output comments to show True for 21:00:00 and 18:31:00, which are within store hours
- Fixed C# code to use logical AND (
&&) instead of bitwise AND (&) for boolean comparison - Added Project.vbproj file to enable building and testing the Visual Basic snippet
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.choosingdates/vb/datetimereplacement1.vb | Corrected expected output comments for 21:00 and 18:31 from False to True |
| samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.choosingdates/vb/Project.vbproj | Added project file for building VB snippet, consistent with C# equivalent |
| samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs | Fixed bitwise AND operator to logical AND for proper boolean short-circuit evaluation |
gewarren
approved these changes
Feb 6, 2026
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.choosingdates/vb/Project.vbproj
Outdated
Show resolved
Hide resolved
BillWagner
approved these changes
Feb 6, 2026
samples/snippets/csharp/VS_Snippets_CLR/conceptual.choosingdates/cs/datetimereplacement1.cs
Show resolved
Hide resolved
…ngdates/vb/Project.vbproj Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TimeSpan structure example showed incorrect output indicating a store closing at 21:30 was closed at 21:00, confusing readers about the example's behavior.
Changes
&to logical AND&&in time comparisonThe bitwise operator happened to work for boolean values but was semantically incorrect.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.