Adopt C# 12 collection expressions for empty lists/dicts
Refactored code to use C# 12 collection expressions ([]) for initializing empty lists and dictionaries instead of the older constructors. This change modernizes and simplifies collection initialization across models, services, and API clients without altering any logic.
This commit is contained in:
@@ -17,7 +17,7 @@ public class CatalogApiClient : ICatalogApiClient
|
||||
public async Task<List<CatalogReadDto>> GetAllAsync(CancellationToken ct = default)
|
||||
{
|
||||
var result = await _httpClient.GetFromJsonAsync<List<CatalogReadDto>>(Endpoint, ct);
|
||||
return result ?? new List<CatalogReadDto>();
|
||||
return result ?? [];
|
||||
}
|
||||
|
||||
public async Task<CatalogReadDto?> GetByIdAsync(int id, CancellationToken ct = default)
|
||||
|
||||
Reference in New Issue
Block a user