메뉴 건너뛰기

게임 커뮤니티 4브론즈

IT 해외 뉴스

本文翻译于David Pine的这篇文章:Refactor your code with default lambda parameters 。 本文是探讨 C# 12的各种功能的四篇系列文章中的最后一篇。在这篇文章中,我们将探讨“默认 lambda 参数”功能,使开发人员能够在 lambda 表达式中使用默认参数值。本系列涵盖了很多内容:  使用主构造函数重构 C# 代码  使用集合表达式重构 C# 代码  使用任意类型别名重构 C# 代码  使用默认 lambda 参数重构C#代码(本篇文章) 这些功能是我们不断努力提高代码可读性和可维护性的一部分。让我们详细探索它们!  默认 Lambda 参数🧮 默认 lambda 参数是 C# 12 中的一项新功能,允许开发人员在 lambda 中表达默认参数值。此功能是 C# 方法中现有默认参数功能的自然扩展。  C# 12 之前🕰️ 在 C# 12 之前,当您定义需要提供某种默认行为的 lambda 表达式时,您必须使用空合并运算符 (??) 或条件运算符 (?:)。请查看以下示例:  var IncrementBy = static (int source,


원문출처 : https://devblogs.microsoft.com/dotnet-ch/c12%E6%96%B0%E5%8A%9F%E8%83%BD%E5%90%88%E9%9B%86%E5%9B%9B%EF%BC%9A%E4%BD%BF%E7%94%A8%E9%BB%98%E8%AE%A4-lambda-%E5%8F%82%E6%95%B0%E9%87%8D%E6%9E%84c%E4%BB%A3%E7%A0%81
번호 제목 글쓴이 날짜 조회 수
공지 자동수집 대상 사이트 KanoT 2023.02.14 2159
2330 [DevBlogs] Add AI to Your .NET Apps Easily with Prompty 뉴스봇 2024.07.23 120
2329 [DevBlogs] Improving GitHub Copilot Completions in VS Code for C++ Developers 뉴스봇 2024.07.22 1182
2328 [DevBlogs] Organizing the five creation dispositions of the Create­File function 뉴스봇 2024.07.22 127
» [DevBlogs] C#12新功能合集四:使用默认 lambda 参数重构C#代码 뉴스봇 2024.07.22 141
2326 [DevBlogs] Creating an already-completed asynchronous activity in C++/WinRT, part 9 뉴스봇 2024.07.19 202
2325 [DevBlogs] Announcing a new Learn module: Use service principal authentication in custom connectors 뉴스봇 2024.07.19 1362
2324 [Stack Overflow] Java, but why? The state of Java in 2024 뉴스봇 2024.07.19 180
2323 [DevBlogs] Introducing CoreWCF and WCF Client Azure Queue Storage bindings for .NET 뉴스봇 2024.07.19 193
2322 [DevBlogs] PIX 2407.17-preview: Mesh Nodes in Work Graphs 뉴스봇 2024.07.19 156
2321 [DevBlogs] D3D12 Preview: Mesh Nodes in Work Graphs 뉴스봇 2024.07.19 203
2320 [DevBlogs] .NET 6 will reach End of Support on November 12, 2024 뉴스봇 2024.07.19 198
2319 [DevBlogs] Announcing the stable release of Azure Event Grid Namespaces HTTP client libraries 뉴스봇 2024.07.19 171
2318 [DevBlogs] Managed DevOps Pools – The Origin Story 뉴스봇 2024.07.19 1373
2317 [DevBlogs] Three New Premium Visual Studio Subscriber Benefits Announced 뉴스봇 2024.07.19 176
2316 [DevBlogs] Latest NoSQL Java Ecosystem Updates 2024 Q1 & Q2 뉴스봇 2024.07.18 1266
2315 [DevBlogs] Creating an already-completed asynchronous activity in C++/WinRT, part 8 뉴스봇 2024.07.18 188
2314 [DevBlogs] Building React Native for Windows Apps from a Mac 뉴스봇 2024.07.18 1220
2313 [DevBlogs] Model as a Service (MaaS) Available for Semantic Kernel 뉴스봇 2024.07.18 164
2312 [DevBlogs] NuGetAudit 2.0: Elevating Security and Trust in Package Management 뉴스봇 2024.07.18 1222
2311 [DevBlogs] Creating an already-completed asynchronous activity in C++/WinRT, part 7 뉴스봇 2024.07.17 206
위로