Make SearchResult readonly and init HighlightData to empty list

Changed SearchResult to a readonly record struct for better immutability and performance. Updated HighlightData to initialize as an empty list using a collection expression instead of null. Retained the default constructor with a clarifying comment.
This commit is contained in:
Jack251970 2026-01-05 09:45:32 +08:00
parent 10f160d9a2
commit 43d3963e3d

View file

@ -2,8 +2,9 @@
namespace Flow.Launcher.Plugin.Explorer.Search
{
public record struct SearchResult
public readonly record struct SearchResult
{
// Constructor is necesssary for record struct
public SearchResult()
{
}
@ -13,6 +14,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search
public int Score { get; init; }
public bool WindowsIndexed { get; init; }
public List<int> HighlightData { get; init; } = null;
public List<int> HighlightData { get; init; } = [];
}
}