我在只读属性中返回对字典的引用。如何防止用户更改我的数据?如果这是一个 IList
,我可以简单地返回它 AsReadOnly
。我可以用字典做类似的事情吗?
Private _mydictionary As Dictionary(Of String, String)
Public ReadOnly Property MyDictionary() As Dictionary(Of String, String)
Get
Return _mydictionary
End Get
End Property