Retrieves a value indicating whether the field is private.
[Visual Basic] Public ReadOnly Property IsPrivate As Boolean [C#] public bool IsPrivate {get;} [C++] public: __property bool get_IsPrivate(); [JScript] public function get IsPrivate() : Boolean;
Read-only. true if the field is private; otherwise; false.
Private fields are accessible only from member functions and subclasses.
The IsPrivate property is set when the FieldAttributes.Private attribute is set.
To get the IsPrivate property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the IsPrivate. If the property is other than public, it is protected and cannot be readily accessed. To access a non public property, in the GetField method, set the BindingFlags to NonPublic.
FieldInfo Class | FieldInfo Members | System.Reflection Namespace