Refactor to use target-typed new and inline object initializers for cleaner and more concise code. Remove redundant static readonly Utf8Encoding instances in favor of Encoding.UTF8.
This commit is contained in:
@@ -79,7 +79,7 @@ public class AspnetCoreWebContext : IWebContext
|
||||
_requestForm = _context.Request.Form
|
||||
.ToDictionary(p => p.Key, p => p.Value[0]);
|
||||
}
|
||||
else { _requestForm = new Dictionary<string, string?>(); }
|
||||
else { _requestForm = new(); }
|
||||
}
|
||||
|
||||
return _requestForm;
|
||||
@@ -129,7 +129,7 @@ public class AspnetCoreWebContext : IWebContext
|
||||
_context.Response.Cookies.Append(
|
||||
key: cookieName,
|
||||
value: value,
|
||||
options: new CookieOptions { Expires = expiration, HttpOnly = httpOnly, Secure = secure, }
|
||||
options: new() { Expires = expiration, HttpOnly = httpOnly, Secure = secure, }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ public static class DefaultMain
|
||||
{
|
||||
public static void WebFormCoreMain(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var app = builder.Build();
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.UseGlobalRouterMiddleware(builder.Environment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user