get_ & set_

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ACG

    #1

    get_ & set_

    Newbie Proble

    I have created one project, that I am now referencing in an other. In the new project I seem to be seeing properties of classes as get_Amount and set_Amount

    Which is aweful to write code quickly to, for the quickinfo dropdown then becomes useless, for you simple want to select Amount

    Is this a "feature" or a bug that is in the ide

    Regards
    ACG
  • Mickey Williams

    #2
    Re: get_ & set_


    I may be answering the wrong question, but all properties in C# and VB.NET
    are actually implemented as methods named get_XXX and set_XXX, with some
    metadata markup added to the assembly (this plumbing is more obvious exposed
    in MC++ and J#). There are several CLS rules that govern property interop,
    and both VB and C# are hardwired to follow the CLS when creating their
    properties. So are you not able to call the properties directly? Or is it
    just a problem with Intellisense? What version of Visual Studio are you
    running?
    --
    Mickey Williams
    Author, "Microsoft Visual C# .NET Core Reference", MS Press




    "ACG" <anonymous@disc ussions.microso ft.com> wrote in message
    news:E5608BE6-9F40-40CB-B329-CF1106EEB04B@mi crosoft.com...[color=blue]
    > Newbie Problem
    >
    > I have created one project, that I am now referencing in an other. In the[/color]
    new project I seem to be seeing properties of classes as get_Amount and
    set_Amount.[color=blue]
    >
    > Which is aweful to write code quickly to, for the quickinfo dropdown then[/color]
    becomes useless, for you simple want to select Amount.[color=blue]
    >
    > Is this a "feature" or a bug that is in the ide?
    >
    > Regards,
    > ACG[/color]


    Comment

    • ACG

      #3
      Re: get_ &amp; set_

      I hope I can convey this well. When setting/getting a property of a class inside its own project, I get

      foo.Amoun

      When I use intellisense in another project that has a reference to the other projects' class library, I get

      foo.get_Amoun

      foo.set_Amoun

      I would love to have just foo.Amount. Is this a studio 2003 problem

      Regards
      Ada

      Comment

      • Mickey Williams

        #4
        Re: get_ &amp; set_

        So is it just an Intellisense problem, or do you actually get a compiler
        error with foo.Amount from the second project?

        --
        Mickey Williams
        Author, "Microsoft Visual C# .NET Core Reference", MS Press



        "ACG" <anonymous@disc ussions.microso ft.com> wrote in message
        news:DB47363A-9EC1-4C52-B09C-0BADE89EED0D@mi crosoft.com...[color=blue]
        > I hope I can convey this well. When setting/getting a property of a class[/color]
        inside its own project, I get:[color=blue]
        >
        > foo.Amount
        >
        > When I use intellisense in another project that has a reference to the[/color]
        other projects' class library, I get:[color=blue]
        >
        > foo.get_Amount
        > &
        > foo.set_Amount
        >
        > I would love to have just foo.Amount. Is this a studio 2003 problem?
        >
        > Regards,
        > Adam
        >[/color]


        Comment

        • Frank Oquendo

          #5
          Re: get_ &amp; set_

          <off topic>

          Hey Mickey,

          I just wanted to thank you for a great book. Yours was one of the first
          I bought when I made the switch from VB6 to C# and I've been using it
          ever since. Keep up the good work.

          --
          There are 10 kinds of people. Those who understand binary and those who
          don't.


          (Pull the pin to reply)


          Comment

          • Mickey Williams

            #6
            Re: get_ &amp; set_

            Cool, thanks for that.
            I'm currently planning the update and building sample code, so feel free to
            drop me a note if there are any topics that you'd like to see included (or
            changed) in the Whidbey version of the book. My email address is [my first
            name] at servergeek dot com.

            --
            Mickey Williams
            Author, "Microsoft Visual C# .NET Core Reference", MS Press



            "Frank Oquendo" <frankopin@acad x.com> wrote in message
            news:uwS5pUkrDH A.1512@TK2MSFTN GP10.phx.gbl...[color=blue]
            > <off topic>
            >
            > Hey Mickey,
            >
            > I just wanted to thank you for a great book. Yours was one of the first
            > I bought when I made the switch from VB6 to C# and I've been using it
            > ever since. Keep up the good work.
            >
            > --
            > There are 10 kinds of people. Those who understand binary and those who
            > don't.
            >
            > http://code.acadx.com
            > (Pull the pin to reply)
            >
            >[/color]


            Comment

            Working...