C# 12 simplifies code with collection expressions, primary constructors for all classes and structs, syntax to alias any type, and default parameters for lambda expressions. Credit: PeopleImages / Getty Images C# 12, the latest edition of Microsoft’s popular object-oriented programming language, is now available as a production release, offering a simplified syntax and faster program execution. C# 12 was unveiled as part of the .NET 8 software development platform on November 14. Developers can access it by downloading .NET 8, the Visual Studio 2022, or the Visual Studio Code C# Dev Kit extension. To simplify code, C# 12 introduces collection expressions, primary constructors for all classes and structs, syntax to alias any type, and default parameters for lambda expressions. Collection expressions introduce a new terse syntax to create common collection values. Microsoft in noting these capabilities stressed it has set a goal for new features to not degrade performance. To make code execution faster, C# 12 adds ref readonly parameters and inline arrays. Adding ref readonly parameters provides a final combination of passing parameters by reference or by value. An argument to a ref readonly parameter must be a variable. Inline arrays, which are a struct-based, fixed-length array type, provide a safe way to work with memory buffers. Interceptors, an experimental feature available in preview, allow redirection of method calls. C# also features an experimental attribute, SystemDiagnostics.CodeAnalysis.ExperimentalAttribute, that makes it clear when Microsoft is not yet committed to a feature or implementation. When code uses types or members that are experimental, an error will occur unless the calling code is also marked as experimental. Each use of ExperimentalAttribute has a diagnostic ID for suppressing the error for individual features by an explicit compiler option or #pragma so developers can explore the experimental feature. Types, members, and assemblies can be marked with ExperimentalAttribute. C# 12 ranks fifth in the Tiobe index of programming language popularity this month, ahead of languages such as JavaScript and PHP. Preceding C# 12 was C# 11, released in November 2022, featuring string literals and generic math. Related content news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages analysis And the #1 Python IDE is . . . PyCharm, VS Code, and five other popular Python IDEs duke it out. Which one do you think takes home the prize? By Serdar Yegulalp Nov 15, 2024 2 mins Python Programming Languages Software Development news JDK 24: The new features in Java 24 21 features are proposed for the next version of Java including quantum-resistant cryptographic keys designed to secure Java apps against future quantum computing attacks. By Paul Krill Nov 15, 2024 11 mins Java Programming Languages Software Development news Rust Foundation moves forward on C++ and Rust interoperability Problem statement released to address the challenges to making cross-language development with C++ and Rust more accessible and approachable. By Paul Krill Nov 14, 2024 2 mins C++ Rust Programming Languages Resources Videos