Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

Create a List property which cannot be changed externally

$
0
0
I'm creating RecentFiles class contains
Code:

    Private mstrItems As List(Of String)
    Public Property Items() As List(Of String)
        Get
            Return mstrItems
        End Get

        Set(ByVal value As List(Of String))
            mstrItems = value
            ' Do some stuff
        End Set
    End Property


I don't want Items change from outside the class like this
Code:

rf = New RecentFiles
rf.Items.Add("some value")


Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>