-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Stopwatch.ToString() (#87812)
* Implement Stopwatch.ToString() For the tests, I added a few one-liners to the existing tests where the Stopwatch.Elapsed property was easy to check. I also added the OverridesToString() test to check for cases where the ToString() method is called implicitly. This confirms that people can write "Console.WriteLine(sw)" where "sw" is an instance of the Stopwatch class, and get the elapsed time printed. Fix #87449 * Fix typo in Stopwatch.cs Fix typo in the comment within the OverridesToString() test. * Add XML docs for the ToString() method. The <returns> tag is somewhat redundant since the <summary> tag adequately describes what's going on here, but since the convention is to have both tags, I have used the <returns> tag to clarify that the returned string renders the elapsed time using the same format as TimeSpan.ToString(). * Add ToString() override for Stopwatch class. See #87812 (comment) --------- Co-authored-by: Eric Mutta <ericm@creditregistry.com>
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 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
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