Click here to Skip to main content
15,881,027 members

Survey Results

Rate these 5 C# language improvements

Survey period: 30 Aug 2021 to 6 Sep 2021

For the C# devs. The language grows, so rate some of these additions from 1 = completely useless to 5 = Best thing since sliced bread.

OptionVotes12345 
Implicit new: MyClass x = new()52320%14%26%20%19%
Syntax patterns c is >= 'a' and <= 'z'52323%16%31%18%12%
Switch: myVar switch { "value" => value, ... _ }52318%15%32%20%15%
Null-coalescing assign: myList ??= new List<int>();52315%15%25%25%20%
Indices and range: mystring[1..^4]52317%15%24%25%17%



 
GeneralI'm looking forward to them... Pin
Gary R. Wheeler31-Aug-21 15:07
Gary R. Wheeler31-Aug-21 15:07 
GeneralThey're all useless to me. Pin
RafagaX31-Aug-21 6:48
professionalRafagaX31-Aug-21 6:48 
GeneralWhy do they even bother to use new. Just use MyClass x; and new it in GC internally Pin
steveb31-Aug-21 2:59
mvesteveb31-Aug-21 2:59 
GeneralRe: Why do they even bother to use new. Just use MyClass x; and new it in GC internally Pin
BillWoodruff5-Sep-21 13:58
professionalBillWoodruff5-Sep-21 13:58 
Generalmost of them are useless Pin
Stepan Hakobyan30-Aug-21 20:26
professionalStepan Hakobyan30-Aug-21 20:26 
GeneralRe: most of them are useless Pin
hakimio30-Aug-21 21:11
hakimio30-Aug-21 21:11 
GeneralMixed bag Pin
r_hyde30-Aug-21 20:01
r_hyde30-Aug-21 20:01 
GeneralAre any of them even supported in .net 4.x? Pin
Dan Neely30-Aug-21 3:34
Dan Neely30-Aug-21 3:34 
GeneralRe: Are any of them even supported in .net 4.x? Pin
markrlondon30-Aug-21 3:52
markrlondon30-Aug-21 3:52 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Richard Deeming30-Aug-21 21:53
mveRichard Deeming30-Aug-21 21:53 
All of the listed features except for indices and range are supported in .NET 4.x, but you need to manually edit your project file to change the language version.

Index and range support can be enabled, but you need to define various classes in your own code. If you have any code which uses System.Runtime.CompilerServices.RuntimeHelpers, adding index/range support will break it.

Using C# 9 outside .NET 5 · Discussion #47701 · dotnet/roslyn · GitHub[^]
How to use C# 8 Indices and Ranges in .NET Standard 2.0 and .NET Framework - Meziantou's blog[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Are any of them even supported in .net 4.x? Pin
BillWoodruff5-Sep-21 14:01
professionalBillWoodruff5-Sep-21 14:01 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Matt McGuire31-Aug-21 4:29
professionalMatt McGuire31-Aug-21 4:29 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Brisingr Aerowing31-Aug-21 10:07
professionalBrisingr Aerowing31-Aug-21 10:07 
GeneralMeh Pin
ronlease30-Aug-21 2:36
professionalronlease30-Aug-21 2:36 
GeneralMissing option Pin
Greg Utas30-Aug-21 2:03
professionalGreg Utas30-Aug-21 2:03 
GeneralMore like syntactic sugar ... Pin
Amarnath S30-Aug-21 1:02
professionalAmarnath S30-Aug-21 1:02 
GeneralNull-coalescing assign - maybe useful? Pin
Slacker00730-Aug-21 0:52
professionalSlacker00730-Aug-21 0:52 
GeneralRe: Null-coalescing assign - maybe useful? Pin
Sander Rossel30-Aug-21 2:24
professionalSander Rossel30-Aug-21 2:24 
GeneralRe: Null-coalescing assign - maybe useful? Pin
James Lonero31-Aug-21 12:51
James Lonero31-Aug-21 12:51 
GeneralThey're all just shortcuts... Pin
Sander Rossel29-Aug-21 22:05
professionalSander Rossel29-Aug-21 22:05 
PraiseRe: They're all just shortcuts... Pin
Christiaan van Bergen29-Aug-21 22:43
professionalChristiaan van Bergen29-Aug-21 22:43 
GeneralRe: They're all just shortcuts... Pin
Mladen Janković2-Sep-21 4:23
Mladen Janković2-Sep-21 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.