Private Members in Watch Window

madaxe

Member
Joined
Mar 18, 2008
Messages
16
Programming Experience
1-3
Why is it when i add a watch to the new instance of the "NeuralNetwork" i see the _Layers property? Even though it's Private.

Madaxe


VB.NET:
Friend Class NeuralNetwork

    Private _Layers As New List(Of Layer)

    Public ReadOnly Property Layers() As List(Of Layer)

        Get
            Return _layers
        End Get

    End Property

End Class

Friend Class Layer

    Private _Neurons As New List(Of Neuron)

    Public ReadOnly Property Neurons() As List(Of Neuron)

        Get
            Return _Neurons
        End Get

    End Property

End Class

Friend Class Neuron

End Class
 
I've created a new thread for this question because it wasn't related to the topic of the thread it was posted in.

Why? The Watch window is a debugging tool and it's often useful to get the values of private members while debugging.

How? Most likely using Reflection. You can get basically any information about an object using Reflection, even if you don't know anything about it to begin with.
 
How? Most likely using Reflection.
This information is retrieved using the pdb. For external references where the pdb is not available this information is also not available.
 
Back
Top