Skip to content

Commit d7fad8b

Browse files
committed
Collection initializers
1 parent a7ba9f4 commit d7fad8b

File tree

14 files changed

+36
-36
lines changed

14 files changed

+36
-36
lines changed

src/ServiceControl.LicenseManagement/LicenseDetails.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static LicenseDetails TrialFromEndDate(DateOnly endDate)
3333
LicenseType = "Trial",
3434
ExpirationDate = endDate.ToDateTime(TimeOnly.MinValue),
3535
IsExtendedTrial = false,
36-
ValidApplications = new List<string> { "All" }
36+
ValidApplications = ["All"]
3737
});
3838
}
3939

@@ -44,7 +44,7 @@ public static LicenseDetails TrialExpired()
4444
LicenseType = "Trial",
4545
ExpirationDate = DateTime.UtcNow.Date.AddDays(-2), //HasLicenseDateExpired uses a grace period of 1 day
4646
IsExtendedTrial = false,
47-
ValidApplications = new List<string> { "All" }
47+
ValidApplications = ["All"]
4848
});
4949
}
5050

src/ServiceControlInstaller.Engine/Accounts/Lsa.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static string[] GetPrivileges(string identity)
2525
// the user has no privileges
2626
if (win32ErrorCode == StatusObjectNameNotFound)
2727
{
28-
return new string[0];
28+
return [];
2929
}
3030

3131
HandleLsaResult(result);

src/ServiceControlInstaller.Engine/Configuration/ServiceControl/UpgradeInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
public class UpgradeInfo
77
{
88
static readonly SemanticVersion[] LastVersionForEachMajor =
9-
{
9+
[
1010
new(1, 48, 0),
1111
new(2, 1, 5),
1212
new(3, 8, 4),
1313
new(4, 33, 0), // Added IngestErrorMessages setting to enable message replay during 4to5 upgrade guide scenario
14-
new(5, 11, 0),
15-
};
14+
new(5, 11, 0)
15+
];
1616

1717
public SemanticVersion[] UpgradePath { get; private init; }
1818
public bool HasIncompatibleVersion { get; private init; }

src/ServiceControlInstaller.Engine/Instances/MonitoringNewInstance.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ string[] FlagFiles
3232
get
3333
{
3434
const string flagFileName = ".notconfigured";
35-
return new[]
36-
{
35+
return
36+
[
3737
Path.Combine(InstallPath, flagFileName),
3838
Path.Combine(LogPath, flagFileName)
39-
};
39+
];
4040
}
4141
}
4242

src/ServiceControlInstaller.Engine/Instances/PersistenceManifest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public class PersistenceManifest
1515

1616
public bool IsSupported { get; set; } = true;
1717

18-
public Setting[] Settings { get; set; } = Array.Empty<Setting>();
18+
public Setting[] Settings { get; set; } = [];
1919

20-
public string[] SettingsWithPathsToCleanup { get; set; } = Array.Empty<string>();
20+
public string[] SettingsWithPathsToCleanup { get; set; } = [];
2121

22-
public string[] Aliases { get; set; } = Array.Empty<string>();
22+
public string[] Aliases { get; set; } = [];
2323

2424
internal bool IsMatch(string persistenceType) =>
2525
string.Equals(TypeName, persistenceType, StringComparison.Ordinal) // Type names are case-sensitive

src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public virtual void DisableMaintenanceMode()
330330

331331
protected virtual IEnumerable<string> GetPersistencePathsToCleanUp()
332332
{
333-
return Enumerable.Empty<string>();
333+
return [];
334334
}
335335

336336
protected virtual void ValidateConnectionString()

src/ServiceControlInstaller.Engine/Instances/ServiceControlInstallableBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ string[] FlagFiles
5959
get
6060
{
6161
const string flagFileName = ".notconfigured";
62-
return new[]
63-
{
62+
return
63+
[
6464
Path.Combine(InstallPath, flagFileName),
6565
Path.Combine(DBPath, flagFileName),
6666
Path.Combine(LogPath, flagFileName)
67-
};
67+
];
6868
}
6969
}
7070

src/ServiceControlInstaller.Engine/Instances/ServiceControlInstance.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ServiceControlInstance(IWindowsServiceController service) : base(service)
2626

2727
public TimeSpan? AuditRetentionPeriod { get; set; }
2828

29-
public List<RemoteInstanceSetting> RemoteInstances { get; set; } = new List<RemoteInstanceSetting>();
29+
public List<RemoteInstanceSetting> RemoteInstances { get; set; } = [];
3030

3131
public PersistenceManifest PersistenceManifest { get; set; }
3232

@@ -207,12 +207,12 @@ protected override void Prepare(string zipFilePath, string destDir)
207207
protected override IEnumerable<string> GetPersistencePathsToCleanUp()
208208
{
209209
string[] keys =
210-
{
210+
[
211211
"Raven/IndexStoragePath",
212212
"Raven/CompiledIndexCacheDirectory",
213213
"Raven/Esent/LogsPath",
214214
ServiceControlSettings.DBPath.Name
215-
};
215+
];
216216

217217
var settings = AppConfig.Config.AppSettings.Settings;
218218
foreach (var key in keys)

src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public override void WriteConfigurationFile()
4242

4343
public override string DirectoryName => "ServiceControl";
4444

45-
public List<RemoteInstanceSetting> RemoteInstances { get; set; } = new List<RemoteInstanceSetting>();
45+
public List<RemoteInstanceSetting> RemoteInstances { get; set; } = [];
4646

4747
public void AddRemoteInstance(string apiUri)
4848
{

src/ServiceControlInstaller.Engine/Instances/TransportInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class TransportInfo
2121

2222
public string AutoMigrateTo { get; set; }
2323

24-
public string[] Aliases { get; set; } = Array.Empty<string>();
24+
public string[] Aliases { get; set; } = [];
2525

2626
public string ZipName
2727
{
@@ -65,6 +65,6 @@ public override int GetHashCode()
6565

6666
public class TransportManifest
6767
{
68-
public TransportInfo[] Definitions { get; set; } = Array.Empty<TransportInfo>();
68+
public TransportInfo[] Definitions { get; set; } = [];
6969
}
7070
}

0 commit comments

Comments
 (0)