CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: c# operator :

  1. #1
    Join Date
    Dec 2010
    Posts
    3

    c# operator :

    what does "showOtherVersions: false" mean in call to method:
    this.discoService.getItemPageInfo(this.discoLoginParams, discoParams, catalogObject,
    showOtherVersions: false,
    showOtherVersionsSpecified: true,
    showPreviews: false,
    showPreviewsSpecified: true);

    I looked in msdn but didn't found such operator?

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: c# operator :

    you think we are good in guessing, don't you? give us some more information. your code does not say anything.

    whatever, I'll try: "showOtherVersions: false" means that other versions should not be shown, because false is not true and what is not true is false it means it is wrong, so it is wrong to show other versions hence other versions won't be shown.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    Dec 2010
    Posts
    3

    Re: c# operator :

    It doesn't matter the name of parameter.
    I was asking about what means when you call a method to put a ':' after a parameter and to put some value as shown in example:

    showOtherVersionsSpecified: true
    showPreviewsSpecified: true

    Since it is a call to a method it cannot be default value, cause it is done on definition and its also not ?? operator for checking null value.


    so what means for definition
    void somemethod(bool obj)
    calling this method as

    somemethod(someboolvar : true);

  4. #4
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: c# operator :

    oh, now I understand ;]

    you just put the name of the parameter before the value to make your code more readable when you need it. there are also certain rules for named parameters like the order doesn't matter or it works only in .net 4.0 but I don't know them all.

    and no, you're calling your example method wrong... you'd have to write:

    somemethod(obj: true);

    because the parameter's name is obj
    Last edited by memeloo; December 5th, 2010 at 03:33 AM.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  5. #5
    Join Date
    May 2007
    Posts
    1,546

    Re: c# operator :

    Personally, I'd stay away from named parameters if at all possible. They're too fragile to depend on. Especially if you care about your app working with multiple versions of the same library, or across different versions of the .NET framework or on different platforms.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

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