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 feature What is Rust? Safe, fast, and easy software development Unlike most programming languages, Rust doesn't make you choose between speed, safety, and ease of use. Find out how Rust delivers better code with fewer compromises, and a few downsides to consider before learning Rust. By Serdar Yegulalp Nov 20, 2024 11 mins Rust Programming Languages Software Development how-to Kotlin for Java developers: Classes and coroutines Kotlin was designed to bring more flexibility and flow to programming in the JVM. Here's an in-depth look at how Kotlin makes working with classes and objects easier and introduces coroutines to modernize concurrency. By Matthew Tyson Nov 20, 2024 9 mins Java Kotlin Programming Languages news F# 9 adds nullable reference types Latest version of Microsoft’s functional .NEt programming language provides a type-safe way to handle reference types that can have null as a valid value. By Paul Krill Nov 18, 2024 3 mins Microsoft .NET Programming Languages Software Development 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 Resources Videos