Click here to Skip to main content
15,125,972 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.

OptionResponses Avg  
Implicit new: MyClass x = new()5233.05
Syntax patterns c is >= 'a' and <= 'z'5232.80
Switch: myVar switch { "value" => value, ... _ }5233.00
Null-coalescing assign: myList ??= new List<int>();5233.20
Indices and range: mystring[1..^4]5233.10



 
GeneralI'm looking forward to them... Pin
Gary R. Wheeler31-Aug-21 16:07
MemberGary R. Wheeler31-Aug-21 16:07 
GeneralThey're all useless to me. Pin
RafagaX31-Aug-21 7:48
professionalRafagaX31-Aug-21 7:48 
GeneralWhy do they even bother to use new. Just use MyClass x; and new it in GC internally Pin
steveb31-Aug-21 3:59
Membersteveb31-Aug-21 3:59 
GeneralRe: Why do they even bother to use new. Just use MyClass x; and new it in GC internally Pin
BillWoodruff5-Sep-21 14:58
mveBillWoodruff5-Sep-21 14:58 
Generalmost of them are useless Pin
Stepan Hakobyan30-Aug-21 21:26
professionalStepan Hakobyan30-Aug-21 21:26 
GeneralRe: most of them are useless Pin
hakimio30-Aug-21 22:11
Memberhakimio30-Aug-21 22:11 
GeneralMixed bag Pin
r_hyde30-Aug-21 21:01
Memberr_hyde30-Aug-21 21: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 4:34
MemberDan Neely30-Aug-21 4:34 
GeneralRe: Are any of them even supported in .net 4.x? PinPopular
markrlondon30-Aug-21 4:52
Membermarkrlondon30-Aug-21 4:52 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Richard Deeming30-Aug-21 22:53
mveRichard Deeming30-Aug-21 22:53 
GeneralRe: Are any of them even supported in .net 4.x? Pin
BillWoodruff5-Sep-21 15:01
mveBillWoodruff5-Sep-21 15:01 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Matt McGuire31-Aug-21 5:29
professionalMatt McGuire31-Aug-21 5:29 
GeneralRe: Are any of them even supported in .net 4.x? Pin
Brisingr Aerowing31-Aug-21 11:07
professionalBrisingr Aerowing31-Aug-21 11:07 
GeneralMeh Pin
ronlease30-Aug-21 3:36
professionalronlease30-Aug-21 3:36 
GeneralMissing option Pin
Greg Utas30-Aug-21 3:03
mvaGreg Utas30-Aug-21 3:03 
GeneralMore like syntactic sugar ... Pin
Amarnath S30-Aug-21 2:02
professionalAmarnath S30-Aug-21 2:02 
GeneralNull-coalescing assign - maybe useful? Pin
Slacker00730-Aug-21 1:52
professionalSlacker00730-Aug-21 1:52 
GeneralRe: Null-coalescing assign - maybe useful? Pin
Sander Rossel30-Aug-21 3:24
professionalSander Rossel30-Aug-21 3:24 
GeneralRe: Null-coalescing assign - maybe useful? Pin
James Lonero31-Aug-21 13:51
MemberJames Lonero31-Aug-21 13:51 
GeneralThey're all just shortcuts... Pin
Sander Rossel29-Aug-21 23:05
professionalSander Rossel29-Aug-21 23:05 
PraiseRe: They're all just shortcuts... Pin
Christiaan van Bergen29-Aug-21 23:43
professionalChristiaan van Bergen29-Aug-21 23:43 
GeneralRe: They're all just shortcuts... Pin
Mladen Janković2-Sep-21 5:23
MemberMladen Janković2-Sep-21 5: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.