Q&A

Useful New-ish Features in .NET/C#

We often hear about the big new features in .NET or C#, but what about all of those lesser known, but useful new features? How exactly do you use constructs like collection indices and ranges, date features, and pattern matching?

It can be hard to keep up with all the updates to Microsoft dev tooling and associated languages, as Microsoft documentation for C# 13 alone lists 10 new features ranging from "params collections" to "Overload resolution priority allows library authors to designate one overload as better than others."

New Features in C# 13
[Click on image for larger view.] New Features in C# 13 (source: Microsoft).

Documentation is fine, but there's a much better learning experience available from real, live, subject-matter humans who keep track of all the new goodies and are eager to explain it to others to help them do their jobs better.

For .NET and C#, that expert is Deborah Kurata, a Microsoft MVP and Google Developer Expert (GDE) who monitors things in her role as a consultant, author and speaker.

In exploring "The Core of .NET" track, she will be educating developers about "Useful New-ish Features in .NET/C#" at the big Visual Studio Live! dev conference being held in Las Vegas March 10-14.

Along with walking through some of the new-ish features in .NET and C#, Kurata will demo how devs can leverage them in their current projects. The event description promises attendees will:

  • Discover the latest gems in C# and .NET
  • Uncover the usefulness of these new(ish) features
  • Master techniques to integrate these features into your current projects

We caught up with Kurata to learn more about the topic and what attendees can expect in her session in a short Q&A.

VisualStudioMagazine: What inspired you to present a session on this topic?
Kurata: While many conference talks highlight the flashiest new features in .NET and C#, some of the most practical and impactful features, like raw string literals and DateOnly, receive little attention. Yet these "unsung heroes" can enhance productivity in everyday development.

Additionally, many organizations adopt a more deliberate approach to upgrading their .NET versions. As a result, features like advanced pattern matching, widely discussed when first introduced, are only now being implemented by many development teams.

"I shine a light on these useful but understated features and provide real-world insights to help teams navigate the gradual adoption of new C# and .NET capabilities."

Deborah Kurata, Microsoft MVP and Google Developer Expert (GDE), Consultant, Speaker, Author

In my session, I aim to bridge this gap. I shine a light on these useful but understated features and provide real-world insights to help teams navigate the gradual adoption of new C# and .NET capabilities.

Inside the Session

What: Useful New-ish Features in .NET/C#

When: March 11, 2025, 1:30 p.m. - 2:45 p.m.

Who: Deborah Kurata, Microsoft MVP and Google Developer Expert (GDE), Consultant, Speaker, Author

Why: Learn some of the new-ish features in .NET and C# and how you can leverage them in your current projects.

Find out more about VS Live! taking place March 10-14 at Paris Las Vegas Hotel & Casino

Can you tease just one specific feature in .NET and C# that the session will cover, and its primary benefits?
Collection expressions, introduced in C#12, are a powerful feature that simplify the creation and initialization of collections. They provide a unified syntax for creating arrays, generic lists, and other collection types.

For example, to create a new array containing a set of strings, use square brackets like this:

string[] cast = ["Frodo", "Bilbo", "Gandalf", "Aragorn", "Arwen", "Eowyn"];

This square bracket syntax is more concise and feels more familiar to developers with experience in other languages, such as JavaScript or TypeScript.

Use a spread element (..) to inline collection values. For example, this code creates a new array from the prior array adding another element.

string[] extendedCast = [.. cast, "Legolas"];

Collection expressions are particularly beneficial in scenarios that require dynamic or complex initialization of collections. Whether you're populating test data, building configurations, or aggregating filtered results, these expressions reduce verbosity and improve readability. With this feature, C# developers can write more expressive, maintainable, and concise code.

Is it hard to integrate these features into existing projects?
Many new features, such as collection expressions and switch expressions, can be easily added to existing projects. Code editors like Visual Studio and VS Code provide a visual notification on code that could be updated to new syntax. And they provide a quick fix to make that change for you.

How do these new features affect compatibility with older versions of .NET and C#?
For each feature covered in this session, I provide the applicable version of C#. That way you'll know which version of the C# compiler that you'll need.

Many of the later C# features can be used in older versions of .NET. Set the language version in your project to try them out.

What upcoming features or improvements should developers anticipate in future releases?
Two of the most anticipated features expected in C# 13, extension members and the field keyword, were delayed and are now slated for a future release. When these features arrive, they promise to fill gaps that have been in the C# language for a long time.

Extension members will allow developers to create extension properties and static extension methods, expanding on the existing ability to extend only instance methods. This will open up new possibilities for extending types with more expressive and versatile APIs.

The field keyword will provide direct access to the automatically generated backing field of an auto-property, a feature that simplifies scenarios where direct interaction with the backing field is necessary. For example, you'll be able to use the field keyword to efficiently implement custom logic in property getters and setters.

More details on these exciting new features will emerge as they get closer to release.

What resources would you recommend for developers to get up to speed with newer features in .NET/C# and prepare for your session?
The great news is that this session requires no prior preparation! With a broad range of topics and features covered, there's something for everyone, regardless of their level of C# expertise.

All you need is a curiosity to explore some of C#'s lesser-known yet incredibly useful features. By the end of the session, you'll be equipped to apply these insights directly to your own applications, enhancing your development skills and productivity.

Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Save $300 when you Register by the Early Bird savings deadline of Feb. 14," said the organizer of the event, which is presented by the parent company of Visual Studio Magazine.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

Subscribe on YouTube