How do I simplify this query?
var cookieList = _httpContextAccessor.HttpContext.Request.Cookies.ToList()
.Select(cookie => new { cookie.Key, cookie.Value })
.AsEnumerable()
.Select(cookie => $"{cookie.Key}={cookie.Value}")
.ToList()
CodePudding user response:
var cookieList = _httpContextAccessor.HttpContext.Request.Cookies // assumed IEnumerable otherwise .ToList is ok
.Select(cookie => $"{cookie.Key}={cookie.Value}")
.ToList()