Skip to content

Commit b6aea9c

Browse files
fix: use collection expressions for IDE0305 compliance
Replace .ToList() with collection expressions ([.. collection]) when assigning to List<T> properties in ManageUserNotificationsViewModel to satisfy IDE0305 code analysis enforced in Release builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cefe2cb commit b6aea9c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/XtremeIdiots.Portal.Web/Controllers/UserController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,21 +392,21 @@ public async Task<IActionResult> ManageNotifications(Guid id, CancellationToken
392392
{
393393
UserProfileId = userProfile.UserProfileId,
394394
DisplayName = userProfile.DisplayName ?? "Unknown",
395-
NotificationTypes = (typesResponse.Result?.Data?.Items ?? []).Select(t => new NotificationTypeEntry
395+
NotificationTypes = [.. (typesResponse.Result?.Data?.Items ?? []).Select(t => new NotificationTypeEntry
396396
{
397397
NotificationTypeId = Guid.TryParse(t.NotificationTypeId, out var tid) ? tid : Guid.Empty,
398398
Name = t.DisplayName,
399399
Description = t.Description,
400400
SupportsEmail = t.SupportsEmail,
401401
SupportsInApp = t.SupportsInSite
402-
}).ToList(),
403-
Preferences = (prefsResponse.Result?.Data?.Items ?? []).Select(p => new NotificationPreferenceEntry
402+
})],
403+
Preferences = [.. (prefsResponse.Result?.Data?.Items ?? []).Select(p => new NotificationPreferenceEntry
404404
{
405405
NotificationTypeId = Guid.TryParse(p.NotificationTypeId, out var pid) ? pid : Guid.Empty,
406406
EmailEnabled = p.EmailEnabled,
407407
InAppEnabled = p.InSiteEnabled
408-
}).ToList(),
409-
Notifications = (notificationsResponse.Result?.Data?.Items ?? []).Select(n => new NotificationEntry
408+
})],
409+
Notifications = [.. (notificationsResponse.Result?.Data?.Items ?? []).Select(n => new NotificationEntry
410410
{
411411
NotificationId = n.NotificationId,
412412
Title = n.Title,
@@ -415,7 +415,7 @@ public async Task<IActionResult> ManageNotifications(Guid id, CancellationToken
415415
SentAt = n.CreatedAt,
416416
IsRead = n.IsRead,
417417
EmailSent = n.EmailSent
418-
}).ToList()
418+
})]
419419
};
420420

421421
return View(vm);

0 commit comments

Comments
 (0)