Click here to Skip to main content
15,867,330 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 
| feature                | vote | remarks                                                                                            |
| ---------------------- | ---- | -------------------------------------------------------------------------------------------------- |
| Implicit new           | 1    | useless as far as I can tell. saves a whopping 4 characters over `var x = new MyClass();`          |
| Syntax patterns        | ?    | need to consider some more. seems to be for pattern matching, could perhaps be a 4 or 5            |
| Switch                 | 3    | I could see using it from time to time                                                             |
| Null-coalescing assign | 3    | I use `myList = myList ?? new List<int>();` often enough for this to save me a little typing       |
| Indices and range      | 5    | I miss Python's list/array slicing, and this is a bit like that but without allocating a new array |

I refuse to acknowledge to the lack of markdown tables on CP Poke tongue | ;-P

modified 1-Sep-21 8:10am.

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 
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.