Click here to Skip to main content
15,883,705 members

Survey Results

For the C# devs: expression body or old school functions?

Survey period: 21 Feb 2022 to 28 Feb 2022

Do you prefer the expression body public override string ToString() => "I am an object"; or the traditional public override string ToString() { return "I am a string"; }?

OptionVotes% 
I prefer the shortened expression body syntax13717.13
I prefer traditional functions31639.50
It depends on the situation18122.63
I don't care8911.13
I'd never heard of expression body definitions779.63



 
GeneralRe: Swift is topping that easy Pin
musefan21-Feb-22 2:55
musefan21-Feb-22 2:55 
GeneralRe: Swift is topping that easy Pin
KarstenK21-Feb-22 3:26
mveKarstenK21-Feb-22 3:26 
GeneralWhat a load of PinPopular
den2k8820-Feb-22 20:50
professionalden2k8820-Feb-22 20:50 
GeneralRe: What a load of Pin
Sammuel Miranda21-Feb-22 8:14
professionalSammuel Miranda21-Feb-22 8:14 
GeneralRe: What a load of Pin
Julian Ragan22-Feb-22 4:59
Julian Ragan22-Feb-22 4:59 
GeneralI prefer the shortened version, but it can be a pain. Pin
OriginalGriff20-Feb-22 19:14
mveOriginalGriff20-Feb-22 19:14 
GeneralRe: I prefer the shortened version, but it can be a pain. Pin
Slacker00721-Feb-22 0:37
professionalSlacker00721-Feb-22 0:37 
GeneralRe: I prefer the shortened version, but it can be a pain. Pin
Rob Grainger23-Feb-22 4:21
Rob Grainger23-Feb-22 4:21 
I absolutely agree - I find they actually make code much easier to read.

When you need to convert to use a block, Ctl+'.' shows an option to convert to use a block, or back to an expression body - which saves a lots of bother.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

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.