写 LINQ 的时候,别习惯性 .ToList() 了。停下来想一想:“我真需要它能增删吗?” 这两行代码看起来差不多,作用也都是立刻执行查询,并把结果存下来。但它们其实有本质区别,适用的场景也不一样。 别急着抄代码,先搞清楚该用哪个,才能写出又快又稳的程序。 用 .ToList():如果你拿到结果后,还想增删元素(比如 Add、Remove、Insert)。 用 .ToArray():如果你只是 ...
缓存是一种有效的性能优化技术,可以显著减少应用程序的响应时间和资源消耗。在.NET平台上,使用缓存可以通过多种方式实现,包括内置的缓存 API、第三方库以及分布式缓存解决方案。本文将介绍在.NET中如何使用缓存来提高性能的最佳实践。 缓存是一种有效 ...
Download and install the .NET Core SDK and Visual Studio. Note: When installing Visual Studio you only need to install the ASP.NET and web development workload. If you have issues downloading the ...
LettuceEncrypt provides API for ASP.NET Core projects to integrate with a certificate authority (CA), such as Let's Encrypt, for free, automatic HTTPS (SSL/TLS) certificates using the ACME protocol.
Swashbuckle 维护不力:Swashbuckle 项目不再由社区所有者积极维护,存在许多问题未得到解决,并且未发布兼容 .NET 8 的正式版本。 转向 Microsoft.AspNetCore.OpenApi:ASP.NET Core 团队将增强 Microsoft.AspNetCore.OpenApi 的功能,以取代 Swashbuckle 并实现 OpenAPI 文档生成。 已有替代 ...
HybridCache is a new API in .NET 9 that brings additional features, benefits, and ease to caching in ASP.NET Core. Here’s how to take advantage of it. Caching is a proven strategy for improving ...
Refit is an open-source library for .NET, .NET Core, and Xamarin that makes consuming REST APIs simpler and easier by enabling you to define the API endpoints as C# interfaces, thereby eliminating the ...