Use collection expressions

This commit is contained in:
Jiří Polášek
2026-02-12 18:36:41 +01:00
parent f991ace57f
commit 2bffae10e3
2 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ internal sealed class OpenWindows
/// <summary>
/// List of all the open windows
/// </summary>
private readonly List<Window> windows = new();
private readonly List<Window> windows = [];
/// <summary>
/// An instance of the class OpenWindows
@@ -40,7 +40,7 @@ internal sealed class OpenWindows
/// <summary>
/// Gets the list of all open windows
/// </summary>
internal List<Window> Windows => new(windows);
internal List<Window> Windows => [..windows];
/// <summary>
/// Gets an instance property of this class that makes sure that

View File

@@ -100,7 +100,7 @@ public class VirtualDesktopHelper
using var virtualDesktopKey = Registry.CurrentUser.OpenSubKey(registryExplorerVirtualDesktops, false);
if (virtualDesktopKey is not null)
{
var allDeskValue = (byte[]?)virtualDesktopKey.GetValue("VirtualDesktopIDs", null) ?? Array.Empty<byte>();
var allDeskValue = (byte[]?)virtualDesktopKey.GetValue("VirtualDesktopIDs", null) ?? [];
if (allDeskValue is not null)
{
// We clear only, if we can read from registry. Otherwise, we keep the existing values.