Use array literal [] for empty CORS origins default

Replaces Array.Empty<string>() with the C# array literal [] when defaulting the CORS allowed origins array. This is a syntactic improvement with no change in behavior.
This commit is contained in:
OlgunR
2026-04-21 15:22:19 +02:00
parent be40c39f47
commit 087708dcf7

View File

@@ -30,7 +30,7 @@ builder.Services.AddCors(options =>
}
else
{
var origins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get<string[]>() ?? Array.Empty<string>();
var origins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get<string[]>() ?? [];
if (origins.Length > 0)
{
policy.WithOrigins(origins)