Minor tweak

Small reduction in allocation for a method that is ever so rarely used, but yay me
This commit is contained in:
Kurt 2026-01-10 23:17:47 -06:00
parent 06d95efc64
commit 733c829570

View File

@ -11,16 +11,16 @@ public static class DialogUtil
{
public bool TrySelectIndex(string caption, string text, IReadOnlyList<string> options, out int index, int preSelect = -1)
{
List<TaskDialogRadioButton> choices = [];
var choices = new TaskDialogRadioButtonCollection();
for (int i = 0; i < options.Count; i++)
choices.Add(new(options[i]) { Tag = i, Checked = (i == preSelect) });
choices.Add(new TaskDialogRadioButton(options[i]) { Tag = i, Checked = (i == preSelect) });
var page = new TaskDialogPage
{
Caption = caption,
Text = text,
Icon = TaskDialogIcon.Information,
RadioButtons = [..choices],
RadioButtons = choices,
DefaultButton = TaskDialogButton.OK,
Buttons = [TaskDialogButton.OK],
AllowCancel = true,