Click here to Skip to main content
15,909,498 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: Well, negative advertising seems to help stop smoking. Will it work here? Pin
Member 1532961328-Sep-21 3:05
Member 1532961328-Sep-21 3:05 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
dandy7228-Sep-21 2:59
dandy7228-Sep-21 2:59 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
den2k8828-Sep-21 3:48
professionalden2k8828-Sep-21 3:48 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
Greg Utas28-Sep-21 4:30
professionalGreg Utas28-Sep-21 4:30 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
Lorenzo Bertolino28-Sep-21 21:29
professionalLorenzo Bertolino28-Sep-21 21:29 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
Greg Utas29-Sep-21 1:12
professionalGreg Utas29-Sep-21 1:12 
GeneralRe: Well, negative advertising seems to help stop smoking. Will it work here? Pin
Caslen28-Sep-21 20:42
Caslen28-Sep-21 20:42 
Question.NET Named arguments, since when? Pin
raddevus27-Sep-21 10:14
mvaraddevus27-Sep-21 10:14 
This is a long story, but I'll try to keep it short.

Background
While tracking down a bug/error in my ASP.NET Core 5.0 MVC app I'm building I discovered that it was because I was attempting to pass in a sample string as the model (from my controller).

But when the engine would try to call the View() constructor it would think I was passing the path / filename of my View class.

C#
return View(myHashString);

When that happened I would see a really cryptic crash stating that the engine could not find my View file. What?!?

All I had to do to fix it was prefix the string I was passing in with model: (named argument) so it could differentiate that I was passing the value as the model and not as the path to the view file:

C#
return View(model:myHashString);

Named Arguments in .NET
But, I was like, uh...how long .NET been taking named arguments?
So I went out and checked the docs for named arguments (down the rabbit hole).

Named and Optional Arguments - C# Programming Guide | Microsoft Docs[^]

That doc says .NET 4 but is dated 09/25/2020.
Did .NET 4 release in 2020?
Is that when named arguments became a thing in .NET?

Anyone?

EDIT : Found wikipedia article[^]:
.NET 4 was way back i 2009. I am slow on the uptake of named args. Blush | :O

modified 27-Sep-21 16:25pm.

AnswerRe: .NET Named arguments, since when? Pin
Pete O'Hanlon27-Sep-21 10:25
mvePete O'Hanlon27-Sep-21 10:25 
GeneralRe: .NET Named arguments, since when? Pin
raddevus27-Sep-21 10:27
mvaraddevus27-Sep-21 10:27 
AnswerRe: .NET Named arguments, since when? Pin
Mladen Janković27-Sep-21 10:44
Mladen Janković27-Sep-21 10:44 
GeneralRe: .NET Named arguments, since when? Pin
dandy7227-Sep-21 10:52
dandy7227-Sep-21 10:52 
GeneralRe: .NET Named arguments, since when? Pin
Mladen Janković27-Sep-21 10:59
Mladen Janković27-Sep-21 10:59 
JokeRe: .NET Named arguments, since when? Pin
raddevus27-Sep-21 11:00
mvaraddevus27-Sep-21 11:00 
AnswerRe: .NET Named arguments, since when? Pin
obermd27-Sep-21 11:46
obermd27-Sep-21 11:46 
GeneralRecommendations for a REAL UPS Pin
Marc Clifton27-Sep-21 9:02
mvaMarc Clifton27-Sep-21 9:02 
GeneralRe: Recommendations for a REAL UPS PinPopular
OriginalGriff27-Sep-21 9:36
mveOriginalGriff27-Sep-21 9:36 
GeneralRe: Recommendations for a REAL UPS Pin
Mike Hankey27-Sep-21 9:52
mveMike Hankey27-Sep-21 9:52 
GeneralRe: Recommendations for a REAL UPS Pin
User 991608027-Sep-21 11:34
professionalUser 991608027-Sep-21 11:34 
GeneralRe: Recommendations for a REAL UPS Pin
Marc Clifton27-Sep-21 13:39
mvaMarc Clifton27-Sep-21 13:39 
GeneralRe: Recommendations for a REAL UPS Pin
jeron127-Sep-21 10:04
jeron127-Sep-21 10:04 
GeneralRe: Recommendations for a REAL UPS Pin
Dan Neely28-Sep-21 3:03
Dan Neely28-Sep-21 3:03 
GeneralRe: Recommendations for a REAL UPS Pin
jeron128-Sep-21 4:40
jeron128-Sep-21 4:40 
GeneralRe: Recommendations for a REAL UPS Pin
Jörgen Andersson27-Sep-21 10:21
professionalJörgen Andersson27-Sep-21 10:21 
GeneralRe: Recommendations for a REAL UPS Pin
Marc Clifton27-Sep-21 13:39
mvaMarc Clifton27-Sep-21 13:39 

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.