CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    [RESOLVED] VS2010 Intellisense

    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?
    Attached Images Attached Images

  2. #2
    Join Date
    Dec 2007
    Posts
    234

    Re: VS2010 Intellisense

    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

  3. #3
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: VS2010 Intellisense

    Another day at work I learned something new :-)

    Thnks!

  4. #4
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: [RESOLVED] VS2010 Intellisense

    You are right: it's strange. I don't understood named parameters at all.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  5. #5
    Join Date
    Dec 2007
    Posts
    234

    Re: [RESOLVED] VS2010 Intellisense

    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

  6. #6
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: [RESOLVED] VS2010 Intellisense

    Quote Originally Posted by TechGnome View Post
    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
    Optional Parameters were added to C# in .Net 4 (C# 4.0).
    ===============================
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured