Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Argh - I can't believe I fell for it

Argh - I can't believe I fell for it

Scheduled Pinned Locked Moved The Lounge
csharpc++
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bob16972
    wrote on last edited by
    #1

    "A property or indexer may not be passed as an out or ref variable" Oh C#, what are you doing to my C++ mind. I know better but I tried to do this anyway. :doh: :-O Properties seemed so cool (for about 2 minutes). My brain is turning to mush mush with all these poorly conceived abstractions.

    C P 2 Replies Last reply
    0
    • B bob16972

      "A property or indexer may not be passed as an out or ref variable" Oh C#, what are you doing to my C++ mind. I know better but I tried to do this anyway. :doh: :-O Properties seemed so cool (for about 2 minutes). My brain is turning to mush mush with all these poorly conceived abstractions.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Properties ARE cool, because they save you writing a get method, or allow you to easily write code based on a variable changing. In fact, some things won't work with a variable and will only work with a property. BUT, C# is a strain on the C++ mind at first, no doubt about that.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      N 1 Reply Last reply
      0
      • C Christian Graus

        Properties ARE cool, because they save you writing a get method, or allow you to easily write code based on a variable changing. In fact, some things won't work with a variable and will only work with a property. BUT, C# is a strain on the C++ mind at first, no doubt about that.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        N Offline
        N Offline
        Nemanja Trifunovic
        wrote on last edited by
        #3

        Christian Graus wrote:

        because they save you writing a get method

        Properties are get/set methods, just with a confusing syntax.

        utf8-cpp

        C 1 Reply Last reply
        0
        • B bob16972

          "A property or indexer may not be passed as an out or ref variable" Oh C#, what are you doing to my C++ mind. I know better but I tried to do this anyway. :doh: :-O Properties seemed so cool (for about 2 minutes). My brain is turning to mush mush with all these poorly conceived abstractions.

          P Offline
          P Offline
          puromtec1
          wrote on last edited by
          #4

          Everything that Christian said...and I've explained to a psuedo-programmer customer once when they asked why duplicate effort with properties that not using properties is like having a daughter being taken out on dates without your knowledge. In this case, your class variable is your daughter. It is a very bad idea.

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            Christian Graus wrote:

            because they save you writing a get method

            Properties are get/set methods, just with a confusing syntax.

            utf8-cpp

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Duh. Therefore they save you having to maintain a variable and a seperate method.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            A 1 Reply Last reply
            0
            • C Christian Graus

              Duh. Therefore they save you having to maintain a variable and a seperate method.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              A Offline
              A Offline
              AspDotNetDev
              wrote on last edited by
              #6

              Well, automatic properties do that, which is nice. Properties themselves can still have a get/set method and you'd likely want to use a private variable. The difference is that it saves the caller from having to call a get/set method... they just have a single property they can use instead.

              [WikiLeaks Cablegate Cables]

              C 1 Reply Last reply
              0
              • A AspDotNetDev

                Well, automatic properties do that, which is nice. Properties themselves can still have a get/set method and you'd likely want to use a private variable. The difference is that it saves the caller from having to call a get/set method... they just have a single property they can use instead.

                [WikiLeaks Cablegate Cables]

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                Yeah, but even then, your get and set were together, instead of just being methods in the general stew of things. whne I started C#, I was horrified, b.c foo.bar = 3; was no longer an operation with known costs. Who knows how much code you're executing when you do that ?

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups