In the members region I declare _Name and assign it the value "NameA" but how do I assign this value conditionally?
The idea is that if in some file there's a value set than that should be the default value and not the hard coded one, if non is set the hard coded one should stick.
Is there an official good way of doing this or is or is wrecking the get/set the only way to accomplish this?
#Region "Members"
Private _Name As String = "NameA"
#End Region
#Region "Properties"
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
En开发者_运维技巧d Set
End Property
#End Region
Maybe your problem is the way your looking to that.
if you explicitly declare a variable assigning a value, you loose the "dynamic requirement", if you are creating a class with properties, properties are the good way to expose a private member.
if you what to create a instance of this class assigning different values, why you dont pass that info by parameters on the class contructor?
精彩评论