外からは読み取り専用で中では変更できるようにする ReadOnlyとProperty - VB.NET
Public ReadOnly Property
で定義してあげればよい。
Public Class TestClass Private _testStr As String Public ReadOnly Property testStr As String Get Return _testStr End Get End Property End Class
Public ReadOnly
だと、中からも変更できなくなってしまうため、Property
を使う!!!
これ知った時、感動した!!!!