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. Accessing .NET private members

Accessing .NET private members

Scheduled Pinned Locked Moved The Lounge
csharpquestionlearning
20 Posts 13 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 Brit

    Brian Delahunty wrote: I really like the: #define private public #define protected public way of doing it in C++... does this work.. can't try it here. Yes, it does work in VS 6. ------------------------------------------ "What happened in that Rhode Island club is shocking. To think that over a hundred people would attend a Great White concert." - The Onion

    B Offline
    B Offline
    Brian Delahunty
    wrote on last edited by
    #11

    Brit wrote: Yes, it does work in VS 6. Cool :-D Regards, Brian Dela :-)

    1 Reply Last reply
    0
    • T tidge

      this guy? You've never heard of Dan Appleman? Pretty big in the vb world. He's written a pretty good whitepaper (and book too) on regex.

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #12

      tidge wrote: this guy? You've never heard of Dan Appleman? I must confess my ignorance. But then again, I am happy to remain ignorant of everything, especially having to do with the VB world. :-D Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
      Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
      Every line of code is a liability - Taka Muraoka
      Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

      T 1 Reply Last reply
      0
      • M Marc Clifton

        tidge wrote: this guy? You've never heard of Dan Appleman? I must confess my ignorance. But then again, I am happy to remain ignorant of everything, especially having to do with the VB world. :-D Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
        Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
        Every line of code is a liability - Taka Muraoka
        Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

        T Offline
        T Offline
        tidge
        wrote on last edited by
        #13

        Marc Clifton wrote: I am happy to remain ignorant of everything, especially having to do with the VB world You lucky guy. :)

        1 Reply Last reply
        0
        • J Jim Crafton

          I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

          A Offline
          A Offline
          Arjan Einbu
          wrote on last edited by
          #14

          It is done through reflection... But you also need to give your code the rights to query for private members... Use the "Administrative Tools/Microsoft .NET Framework Configuration" utility to create permission sets and assign them to code groups (assemblies) When running your code from the VS.NET IDE you might actually have those rights, even though your code don't have those right when run as standalone. I dunno why this is, but one should keep it in mind when developing/using this ability... Even though one would expect privates to remain private whatsoever, this feature can come in quite handy when it comes to creating your own generic classes for serialization/deserialization. (Been there, done that...)

          1 Reply Last reply
          0
          • J Jim Crafton

            I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #15

            I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:

            "Ask not for whom the bell tolls;
            It tolls for thee..."

            V A 2 Replies Last reply
            0
            • J Jim Crafton

              I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

              D Offline
              D Offline
              David Stone
              wrote on last edited by
              #16

              It's obvious that they haven't spent all that much time with .NET. They're going at it a completely roundabout way. You can do it very easily through Reflection.


              Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing

              C 1 Reply Last reply
              0
              • D David Stone

                It's obvious that they haven't spent all that much time with .NET. They're going at it a completely roundabout way. You can do it very easily through Reflection.


                Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #17

                Reflection allows you to easily list the members of a class (even private) but can you actually call those members easily? cheers, Chris Maunder

                1 Reply Last reply
                0
                • J Jim Crafton

                  I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

                  C Offline
                  C Offline
                  Chris Maunder
                  wrote on last edited by
                  #18

                  The comments under this are truly great: "OMG .NET sucks and is so secure. Perl is SO much better because you can do this anyway. Man - Microsoft really screwed up letting this bug through QA. Lucky that Java sandboxes everything so you can't do this so it's more secure. Blah blah blah blah blah". yaawwwwwwn cheers, Chris Maunder

                  1 Reply Last reply
                  0
                  • R Roger Wright

                    I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:

                    "Ask not for whom the bell tolls;
                    It tolls for thee..."

                    V Offline
                    V Offline
                    Vikram A Punathambekar
                    wrote on last edited by
                    #19

                    Roger Wright wrote: to access anyone's private members on the 'net :laugh: How about "In C++, only your friends can handle your private parts" ?
                    Vikram. ----------------------------- My site due for a massive update Radioactive cats have 18 half-lives. "Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.

                    1 Reply Last reply
                    0
                    • R Roger Wright

                      I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:

                      "Ask not for whom the bell tolls;
                      It tolls for thee..."

                      A Offline
                      A Offline
                      Anna Jayne Metcalfe
                      wrote on last edited by
                      #20

                      Good one! :laugh: I don't keep much private these days, but I do like to feel protected. ;) Anna :rose: Homepage | My life in tears "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work. Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In

                      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