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. .NET (Core and Framework)
  4. Can we access private variables using reflection ?

Can we access private variables using reflection ?

Scheduled Pinned Locked Moved .NET (Core and Framework)
question
12 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.
  • S Sreenath Madyastha

    I am sorry to ask this question here :) I need simple answer yes or no

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #2

    Private variables do not exist. They're just an on-going joke started by some OO wackos.

    Jeremy Falcon A multithreaded, OpenGL-enabled application.[^]

    S I 2 Replies Last reply
    0
    • S Sreenath Madyastha

      I am sorry to ask this question here :) I need simple answer yes or no

      C Offline
      C Offline
      Christopher Duncan
      wrote on last edited by
      #3

      I suspect your question will be reflected to the proper forum. :)

      Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com

      1 Reply Last reply
      0
      • S Sreenath Madyastha

        I am sorry to ask this question here :) I need simple answer yes or no

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #4

        not in the lounge, no.

        image processing | blogging

        S 1 Reply Last reply
        0
        • S Sreenath Madyastha

          I am sorry to ask this question here :) I need simple answer yes or no

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

          Well, while I move this to the .NET forum, you could write some code and see for yourself...

          Christian Graus - C++ MVP

          S 1 Reply Last reply
          0
          • J Jeremy Falcon

            Private variables do not exist. They're just an on-going joke started by some OO wackos.

            Jeremy Falcon A multithreaded, OpenGL-enabled application.[^]

            S Offline
            S Offline
            Sreenath Madyastha
            wrote on last edited by
            #6

            But when we watch those variables in VS.NET, we do see those variables. For example check m_roles in GenericPrincipal object.

            C 1 Reply Last reply
            0
            • C Chris Losinger

              not in the lounge, no.

              image processing | blogging

              S Offline
              S Offline
              Sreenath Madyastha
              wrote on last edited by
              #7

              Okies... please move this

              1 Reply Last reply
              0
              • S Sreenath Madyastha

                I am sorry to ask this question here :) I need simple answer yes or no

                C Offline
                C Offline
                Clickok
                wrote on last edited by
                #8

                My reply to you is stored in a private variable. Maybe you can use reflection to discover (or maybe not :rolleyes:).


                Jesus is Love! Tell to someone! :badger:

                1 Reply Last reply
                0
                • C Christian Graus

                  Well, while I move this to the .NET forum, you could write some code and see for yourself...

                  Christian Graus - C++ MVP

                  S Offline
                  S Offline
                  Sreenath Madyastha
                  wrote on last edited by
                  #9

                  Well, I first try .. then ask the question!

                  1 Reply Last reply
                  0
                  • S Sreenath Madyastha

                    I am sorry to ask this question here :) I need simple answer yes or no

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #10

                    Yes, you can.

                    Regards, Nish


                    Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                    Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*)

                    1 Reply Last reply
                    0
                    • S Sreenath Madyastha

                      But when we watch those variables in VS.NET, we do see those variables. For example check m_roles in GenericPrincipal object.

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

                      This is a joke reply, about all you will get to a programming question asked in the lounge.

                      Christian Graus - C++ MVP

                      1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        Private variables do not exist. They're just an on-going joke started by some OO wackos.

                        Jeremy Falcon A multithreaded, OpenGL-enabled application.[^]

                        I Offline
                        I Offline
                        Irshad Sulaimani
                        wrote on last edited by
                        #12

                        Great :laugh:..U R Master Of OO:sigh:

                        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