The title probably isn't very accurate from a developer slang standpoint, but this is what I'm trying to achieve:
I have a structure z with one variable x and upon creating an instance of the structure z, I want x to be constrained to a list of types of x... so z.x = xType.1 or z.x = xType.2 where xType 1 and 2 are strings and x is also a string when it comes down to it.
Dim a As z
a.x = xType.1
Print(a.x) 'outputs "abc" because xType.1 = "abc"
EDIT 1:
Structure Z
Dim X as String
End Structure
Sub Main()
Dim a As Z
a.X = "abc"
Print(a.X) 'outputs "abc"
End Sub
This would be the simplest way where I can assign a.X any value... I want to achieve something like this:
Structure Z
Dim X as ???
End Structure
Sub Main()
Dim a As Z
a.X = XType.abc
Print(a.X) 'outputs "abc"
a.X = XType.Zebra
Print(a.X) 'outputs "Melons"
End Sub
So I have to make another structure or define those XTypes somewhere somehow.
List(Of String)as field inz(note that you should follow .NET naming conventions, so uppercase class/structure names).