Hi all,
I started this week using VS2010. And now I see something strange (at least, I've never seen it in VS08).
In the intellisense (see image), I can see 'queryString:' and 'queryStrings'. What does the first one mean?
Printable View
Hi all,
I started this week using VS2010. And now I see something strange (at least, I've never seen it in VS08).
In the intellisense (see image), I can see 'queryString:' and 'queryStrings'. What does the first one mean?
It's a feature of .NET... Named Parameters... That means you can pass in your parameters in any order, as long as you specify the named parameter, followed by a colon (in C#.... in VB it's colon-equals := ) and the value.
So let's say I have a function void doSomething(string myMessage, int32 timerVal)
I can call it thusly:
doSomething("Hi there", 300)
Or
doSomething(myMessage:"Hi there", timerVal:300)
Or
doSomething(timerVal:300, myMessage:"Hi there")
What's the advantage? I don't know. Other than being able to specify your parameters in any order, and at least then it's explicit what each parameter is (I've found myself checking out the procedure's signature countless time going "What is this parameter I'm passing in?")... there's not much else for it.
-tg
Another day at work I learned something new :-)
Thnks!
You are right: it's strange. I don't understood named parameters at all.
More often than not, I see them used with optional parameters (something that's in VB, not sure if C# supports it or not).
-tg