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. General Programming
  3. C#
  4. Acquiring a property value

Acquiring a property value

Scheduled Pinned Locked Moved C#
questioncsharp
24 Posts 8 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.
  • D Dave Kreskowiak

    Truthfully? Not even close. Sorry, but you've got some more work to do.

    A guide to posting questions on CodeProject[^]
    Dave Kreskowiak

    N Offline
    N Offline
    N8tiv
    wrote on last edited by
    #21

    Like I said, I'm only about halfway through my book… I went back over the book, I didn't find anything in there talking about using properties on different data types… There were a few examples, only on string and int… Maybe, just maybe… It talks about using properties on different data types further in the book. Also, I just got done scouring MSDN and couldn't find anything that talks about using properties on different data types… I also click through the related topics and subjects, still couldn't find anything… Could you point me to a place online or if you have time… Explain it to me here. It would definitely be appreciated for your help. I would like to learn C sharp the right way, I want to be able to write the code myself… I don't want to be a script kiddie!

    My Online Journey

    D 1 Reply Last reply
    0
    • N N8tiv

      Like I said, I'm only about halfway through my book… I went back over the book, I didn't find anything in there talking about using properties on different data types… There were a few examples, only on string and int… Maybe, just maybe… It talks about using properties on different data types further in the book. Also, I just got done scouring MSDN and couldn't find anything that talks about using properties on different data types… I also click through the related topics and subjects, still couldn't find anything… Could you point me to a place online or if you have time… Explain it to me here. It would definitely be appreciated for your help. I would like to learn C sharp the right way, I want to be able to write the code myself… I don't want to be a script kiddie!

      My Online Journey

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #22

      Properties are just little bits of code that gets/sets a value or reference. You access them the exact same way no matter what the class exposing them is. Why use properties at all?? Property "setters" can be written to validate the value being passed in before it's used by the object. They can also be used to kick off other pieces of code, usually depending on the value being passed in. Every class exposes it's own set of properties and methods. What each one does is explained in the documentation for that class. For example, the String class, docs are here[^], only exposes two properties itself, Chars and Length. I don't really know what your having a problem with.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      N 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Properties are just little bits of code that gets/sets a value or reference. You access them the exact same way no matter what the class exposing them is. Why use properties at all?? Property "setters" can be written to validate the value being passed in before it's used by the object. They can also be used to kick off other pieces of code, usually depending on the value being passed in. Every class exposes it's own set of properties and methods. What each one does is explained in the documentation for that class. For example, the String class, docs are here[^], only exposes two properties itself, Chars and Length. I don't really know what your having a problem with.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        N Offline
        N Offline
        N8tiv
        wrote on last edited by
        #23

        I get all of that, "Black Box" type of writing code… Hiding implementation. The only examples I've ever seen or talked about were on strings and ints… It never mentions other types like byte, long, boolean etc. etc. My question is I guess: can you use properties on all of those types?

        My Online Journey

        D 1 Reply Last reply
        0
        • N N8tiv

          I get all of that, "Black Box" type of writing code… Hiding implementation. The only examples I've ever seen or talked about were on strings and ints… It never mentions other types like byte, long, boolean etc. etc. My question is I guess: can you use properties on all of those types?

          My Online Journey

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #24

          Can you use the properties exposed by those types (don't use "on"), yes of course! Using a property exposed by any type at all is exactly the same no matter what type it is.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          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