Click here to Skip to main content
15,914,391 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Dear alcohol Pin
Mark_Wallace1-Dec-16 9:57
Mark_Wallace1-Dec-16 9:57 
JokeDear Mr Hankey Pin
Rajesh R Subramanian1-Dec-16 14:27
professionalRajesh R Subramanian1-Dec-16 14:27 
GeneralBig bad bug in .NET... Pin
Sander Rossel1-Dec-16 6:17
professionalSander Rossel1-Dec-16 6:17 
GeneralRe: Big bad bug in .NET... Pin
Kevin Marois1-Dec-16 6:30
professionalKevin Marois1-Dec-16 6:30 
GeneralRe: Big bad bug in .NET... Pin
Sander Rossel1-Dec-16 8:09
professionalSander Rossel1-Dec-16 8:09 
GeneralRe: Big bad bug in .NET... Pin
#realJSOP1-Dec-16 6:37
professional#realJSOP1-Dec-16 6:37 
GeneralRe: Big bad bug in .NET... Pin
Sander Rossel1-Dec-16 8:11
professionalSander Rossel1-Dec-16 8:11 
GeneralRe: Big bad bug in .NET... Pin
Richard Deeming1-Dec-16 11:13
mveRichard Deeming1-Dec-16 11:13 
John Simmons / outlaw programmer wrote:
They use more stack space than standard parameter passing

Nope.
C#
void Main()
{
    Foo(1, 2);
    Foo(x: 1, y: 2);
}

void Foo(int x, int y) { }

Decompiles to:
MSIL
IL_0000:  ldarg.0     
IL_0001:  ldc.i4.1    
IL_0002:  ldc.i4.2    
IL_0003:  call        UserQuery.Foo
IL_0008:  ldarg.0     
IL_0009:  ldc.i4.1    
IL_000A:  ldc.i4.2    
IL_000B:  call        UserQuery.Foo
IL_0010:  ret  

Calling the method with named parameters compiles to exactly the same IL as standard parameter passing.


John Simmons / outlaw programmer wrote:
they also have no tangible benefit with regards to code readability.

Depends on the method.

If you're using Office Interop, named parameters are much more readable than passing 500 ref missing parameters.

And if your method takes a bool - or worse, mulitple bools - then named parameters make it clearer which parameter each value relates to.



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


GeneralRe: Big bad bug in .NET... Pin
Matt T Heffron2-Dec-16 12:11
professionalMatt T Heffron2-Dec-16 12:11 
GeneralRe: Big bad bug in .NET... Pin
OriginalGriff1-Dec-16 8:33
mveOriginalGriff1-Dec-16 8:33 
GeneralRe: Big bad bug in .NET... Pin
Jon McKee1-Dec-16 9:45
professionalJon McKee1-Dec-16 9:45 
GeneralRe: Big bad bug in .NET... Pin
dandy721-Dec-16 11:00
dandy721-Dec-16 11:00 
GeneralRe: Big bad bug in .NET... Pin
Sander Rossel1-Dec-16 21:16
professionalSander Rossel1-Dec-16 21:16 
GeneralRe: Big bad bug in .NET... Pin
dandy722-Dec-16 3:40
dandy722-Dec-16 3:40 
GeneralRe: Big bad bug in .NET... Pin
Richard Deeming1-Dec-16 11:22
mveRichard Deeming1-Dec-16 11:22 
GeneralRe: Big bad bug in .NET... Pin
Sander Rossel1-Dec-16 21:11
professionalSander Rossel1-Dec-16 21:11 
GeneralThought of the day Pin
OriginalGriff1-Dec-16 4:51
mveOriginalGriff1-Dec-16 4:51 
GeneralRe: Thought of the day Pin
lopatir1-Dec-16 4:56
lopatir1-Dec-16 4:56 
GeneralRe: Thought of the day Pin
Richard Deeming1-Dec-16 4:58
mveRichard Deeming1-Dec-16 4:58 
GeneralRe: Thought of the day Pin
W Balboos, GHB1-Dec-16 5:02
W Balboos, GHB1-Dec-16 5:02 
GeneralRe: Thought of the day Pin
Daniel Pfeffer1-Dec-16 5:07
professionalDaniel Pfeffer1-Dec-16 5:07 
GeneralRe: Thought of the day Pin
den2k881-Dec-16 5:18
professionalden2k881-Dec-16 5:18 
GeneralRe: Thought of the day Pin
Joe Woodbury1-Dec-16 5:26
professionalJoe Woodbury1-Dec-16 5:26 
GeneralRe: Thought of the day Pin
lopatir1-Dec-16 5:30
lopatir1-Dec-16 5:30 
GeneralRe: Thought of the day Pin
Joe Woodbury1-Dec-16 5:32
professionalJoe Woodbury1-Dec-16 5:32 

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.