Hi Developers,
How to use a variable string for member assignment of a class. The field to be compared is represented by an integer value, and based off of an enumeration I want to compare the field represented by that integer. For example, here is the basic idea of what I am trying to accomplish.
My line of code as following
Public Class Point
Public X As Double
Public Y As Double
Public Z As Double
End Class
Public Enum PointEnum As Short
X = 0
Y = 1
Z = 2
End Enum
With a list of Points, I want to be able to compare x, y, or z depending on 'enumValue' that is passed into the program.
Dim PointList As New List(Of Point)
If PointList(0).[Enum].GetName(GetType(PointEnum), enumValue) < someValue Then
...
End If
The PointList(0).[Enum].GetName(GetType(PointEnum), enumValue) is the line I am having trouble with.. If my actual code were as simple as having x, y, and z I would just use a select case or if statements, however the class I am using has over 30 properties.
Any help appreciated.
AVADHESH PATEL
12-Jun-2013