Hello,
I want to make a class that requires a variable of email addresses upon initialization. The class should be able to parse an array of email addresses into a semicolon delimited string OR just accept an already pre-parsed string of semicolon delimited emails.
I'm trying to figure out the best practice on how to implement this when initializing the class. I wrote some code below that I think would work but I can't figure out how to make a property where the calling code could change the emails again after the initialization, with either a string or an array. I tried overloading the "Set" in a property but I am only allowed one Set, so I left it ReadOnly for now. Any thoughts are really appreciated! ;-)
I want to make a class that requires a variable of email addresses upon initialization. The class should be able to parse an array of email addresses into a semicolon delimited string OR just accept an already pre-parsed string of semicolon delimited emails.
I'm trying to figure out the best practice on how to implement this when initializing the class. I wrote some code below that I think would work but I can't figure out how to make a property where the calling code could change the emails again after the initialization, with either a string or an array. I tried overloading the "Set" in a property but I am only allowed one Set, so I left it ReadOnly for now. Any thoughts are really appreciated! ;-)
Code:
Public _Recipients As String
'Created 2 constructers, one to accept an array the other to accept a string
Public Sub New(ByVal Recipients() As String)
_Recipients = "" 'Will write some code to parse the array into a delimited string
End Sub
Public Sub New(ByVal Recipients As String)
_Recipients = Recipients
End Sub
ReadOnly Property Recipients() As String
Get
Return _Recipients
End Get
End Property
End Class