Q&A
Q&A with Jason Bock: What's New in C# 10
C# is inescapable. Microsoft's venerable flagship coding language consistently ranks high in popularity, recently adding half-a-million users, and is one of the top languages for desktop and game developers. With Version 10 well on its way (it'll likely be released in November alongside .NET 6), now is a good time for developers to brush up on their C# skills -- and that means learning about the most useful new and emerging features.
.NET expert and Microsoft MVP Jason Bock is an information goldmine when it comes to C#. Bock will lead a session in November's Live! 360 conference, taking place in Orlando, Fla., called "What's New in C# 10," where he'll go over the best features in the coming C# release, how best to use them, and how developers can participate in C#'s future evolution. We caught up with Bock recently and asked him his thoughts on how C# has grown over the years, and where he sees it going.
VisualStudioMagazine: What's the roadmap for C#?
Bock: When C# and .NET weren't open source, it wasn't easy to know where they were going. Now, all the design work is being done in the open. You can see what features are being proposed for a future version of C#. You can find a ton of information on C# itself.
I think one aspect to watch is C#'s evolution over time and weighing the ability to add new features with potentially breaking the language to support a desirable concept. It's not an easy problem to solve, and I'm interested to see how the C# team tackles this over time.
Broadly speaking, how has .NET's evolution over the years affected C#?
I think we're now at point where the cadence of .NET and C# align very well. We started with the .NET Framework, and then .NET Core became a thing. It started to become harder to build packages that could be used by both runtimes, so .NET Standard became a thing. Now that we have "one" .NET, I believe that it's easier to upgrade and stay current with the evolution of the language and the runtime.
"One aspect to watch is C#'s evolution over time and weighing the ability to add new features with potentially breaking the language to support a desirable concept. It's not an easy problem to solve."
Jason Bock, Microsoft MVP
What's a C# feature that you wish Microsoft would come out with, but it just hasn't materialized?
Generic attributes. This is a capability that the CLR has had for a long time, but it's never been surfaced in C#. You can define generic attributes in the intermediate language of .NET -- IL -- and consume them in C#, but you can't define them in C# directly. There are cases where I think this feature would be useful, and I'm hoping it makes it into C# at some point.
What C# 10 capability are you most excited about? Is there one that you can absolutely do without?
Static abstract members in interfaces is a preview feature, so it technically doesn't count, but developers will be able to experiment with it. I think this feature brings another level of expressivity and design capabilities.
The caller argument expression feature isn't getting as much visibility as global using directives and lambda improvements, but it'll make scenarios like logging easier to determine what was done at the call site. I have the feeling this may be used in ways that go beyond capturing the expression as a string.
How would you rate C# compared to other programming languages now?
Rating and comparing languages are a hard endeavor. They all have their strengths and weaknesses. That said, I think C# is a fine language for a couple of reasons. It's been around for over 20 years, so it has a substantial amount of usage behind it. It's cross-platform, so developers can use it on different operating systems for a wide variety of user scenarios. Finally, it's still actively being maintained by Microsoft, and will be for the foreseeable future.
Favorite version of C#. Go!
This is a hard question to answer. I feel like each version has features that are useful! That said, I'd go with Version 2, because it added generics. I can't imagine what it would be like to be coding in C# without this feature. To be fair, there are good languages that do not have the notion of generics, but it's so pervasive in C#. It's readily apparent that generics is a fundamental aspect of C#.