Skip to content

Commit f5994b0

Browse files
committed
refactor: Allow ManualTimeProvider.Start to be set using property initializers
1 parent b7c6baf commit f5994b0

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Added `ActiveTimers` property to `ManualTimeProvider`. The property will display the number of currently active timers that have a callback scheduled to be called in the future.
1111

12+
- Allow `ManualTimeProvider.Start` to be set using property initializers.
13+
1214
## [1.0.0-rc.1]
1315

1416
- Updated Microsoft.Bcl.TimeProvider package dependency to rc.1 version.

docs/TimeProviderExtensions.ManualTimeProvider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ The default implementation returns [System.TimeZoneInfo.Local](https://docs.micr
135135
Gets the starting date and time for this provider.
136136

137137
```csharp
138-
public System.DateTimeOffset Start { get; }
138+
public System.DateTimeOffset Start { get; set; }
139139
```
140140

141141
#### Property Value

src/TimeProviderExtensions/ManualTimeProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public partial class ManualTimeProvider : TimeProvider
2929
/// <summary>
3030
/// Gets the starting date and time for this provider.
3131
/// </summary>
32-
public DateTimeOffset Start { get; }
32+
public DateTimeOffset Start { get; init; }
3333

3434
/// <summary>
3535
/// Gets or sets the amount of time by which time advances whenever the clock is read via <see cref="GetUtcNow"/>.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#if NETSTANDARD2_0
2+
// Licensed to the .NET Foundation under one or more agreements.
3+
// The .NET Foundation licenses this file to you under the MIT license.
4+
5+
using System.ComponentModel;
6+
7+
namespace System.Runtime.CompilerServices
8+
{
9+
/// <summary>
10+
/// Reserved to be used by the compiler for tracking metadata.
11+
/// This class should not be used by developers in source code.
12+
/// This dummy class is required to compile records when targeting .NET Standard
13+
/// </summary>
14+
[EditorBrowsable(EditorBrowsableState.Never)]
15+
internal static class IsExternalInit
16+
{
17+
}
18+
}
19+
#endif

0 commit comments

Comments
 (0)