Private and Public Properties of type Array
OK, Here's the gist of what I'm trying to do. I'm writing a fantasy
roleplaying game character generator/tracker application. I created a class
library called Item to handle basic inventory for the character. In this
class I have a property called UseableBy which I am wanting to create as a
1-dimensional 3-element array of type String. The first element determines
what character classes can use the item (fighter, thief, wizard, etc.), the
second determines what races can use it (human, elf, dwarf, etc.), and the
third determines what alignments can use it (good, neutral, evil, etc.).
The private property declaration is as follows:
' Initializes array as an empty 3 element array of strings
Private m_arrUseableBy() As String = {"", "", ""}
Furthur on down in the public property section is where I'm getting tangled
up
Public Property UseableBy() As String
Get
Return m_arrUseableBy..ToString
End Get
Set(ByVal Value As String)
m_arrUseableBy = Value
End Set
End Property
I know my problem with mixing the two (private as array of string and public
as string) is what's causing the foul up. Is there any way to declare the
public property as an array of strings so the get and set will match the
private property? I have spent hours pouring through the help files with no
success. All the books I can find just tell me how to declare and initialize
the array as a normal variable.
Dim StringArray(2) As String
Dim StringArray() As String = {"abc", "xyz", "123"}
And so on and so on.
How do I declare a Public Property of type Array? Specifically a
1-dimensional, 3-element Array of type String?
Jeff Cox