Skip to content

Commit a45a821

Browse files
committed
Revert unnecessary changes
1 parent 1c583ec commit a45a821

5 files changed

Lines changed: 29 additions & 10 deletions

File tree

src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationKeyComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ConfigurationKeyComparer : IComparer<string>
1616
/// <summary>
1717
/// The default instance.
1818
/// </summary>
19-
public static ConfigurationKeyComparer Instance { get; } = new();
19+
public static ConfigurationKeyComparer Instance { get; } = new ConfigurationKeyComparer();
2020

2121
/// <summary>A comparer delegate with the default instance.</summary>
2222
internal static Comparison<string> Comparison { get; } = Instance.Compare;

src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.Extensions.Configuration
1414
/// </summary>
1515
public abstract class ConfigurationProvider : IConfigurationProvider
1616
{
17-
private ConfigurationReloadToken _reloadToken = new();
17+
private ConfigurationReloadToken _reloadToken = new ConfigurationReloadToken();
1818

1919
/// <summary>
2020
/// Initializes a new <see cref="IConfigurationProvider"/>

src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationReloadToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Configuration
1212
/// </summary>
1313
public class ConfigurationReloadToken : IChangeToken
1414
{
15-
private CancellationTokenSource _cts = new();
15+
private CancellationTokenSource _cts = new CancellationTokenSource();
1616

1717
/// <summary>
1818
/// Indicates if this token will proactively raise callbacks. Callbacks are still guaranteed to be invoked, eventually.

src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationRoot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ConfigurationRoot : IConfigurationRoot, IDisposable
1515
{
1616
private readonly IList<IConfigurationProvider> _providers;
1717
private readonly IList<IDisposable> _changeTokenRegistrations;
18-
private ConfigurationReloadToken _changeToken = new();
18+
private ConfigurationReloadToken _changeToken = new ConfigurationReloadToken();
1919

2020
/// <summary>
2121
/// Initializes a Configuration root with a list of providers.

src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationSection.cs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,30 @@ public ConfigurationSection(IConfigurationRoot root, string path)
4747
/// </summary>
4848
public string Key
4949
{
50-
// Key is calculated lazily as last portion of Path
51-
get => _key ??= ConfigurationPath.GetSectionKey(_path);
50+
get
51+
{
52+
if (_key == null)
53+
{
54+
// Key is calculated lazily as last portion of Path
55+
_key = ConfigurationPath.GetSectionKey(_path);
56+
}
57+
return _key;
58+
}
5259
}
5360

5461
/// <summary>
5562
/// Gets or sets the section value.
5663
/// </summary>
5764
public string? Value
5865
{
59-
get => _root[Path];
60-
set => _root[Path] = value;
66+
get
67+
{
68+
return _root[Path];
69+
}
70+
set
71+
{
72+
_root[Path] = value;
73+
}
6174
}
6275

6376
/// <summary>
@@ -67,8 +80,14 @@ public string? Value
6780
/// <returns>The configuration value.</returns>
6881
public string? this[string key]
6982
{
70-
get => _root[ConfigurationPath.Combine(Path, key)];
71-
set => _root[ConfigurationPath.Combine(Path, key)] = value;
83+
get
84+
{
85+
return _root[ConfigurationPath.Combine(Path, key)];
86+
}
87+
set
88+
{
89+
_root[ConfigurationPath.Combine(Path, key)] = value;
90+
}
7291
}
7392

7493
/// <summary>

0 commit comments

Comments
 (0)