I know this is a proper enum:
Private Enum Months
JANUARY = 1
FEBRUARY = 2
...
End Enum
However, I want to have an enum where the string will solely be integers.
Example:
Private Enum ColumnCounts
01 = 5
02 = 4
03 = 40
End Enum
The 01, 02 and 03 are all strings. However, if I put "01", [01] or just 01, it tells me it expects the end of the Enum and that it isn't a valid statement. Is there any way to accomplish this that I'm missing? I even tried. 01.ToString(), but that wasn't an option. :) Any and all help is appreciated. Thanks.
Edit:
Public Class Part
Private Enum ColumnCounts
f01 = 39
End Enum
Public Shared Function ValidateColumns(ByRef lstFields As List(Of String)) As Boolean
For Each colCount In [Enum].GetValues(GetType(ColumnCounts))
If colCount = "f" + lstFields(1) Then
'Right here I need to compare the count of the list vs. the value of the enum.'
Return True
End If
Next
Return False
End Function
End Class
Essentially, I didn't want to put the f in there, just wanted to do 01. The way this will be called is:
Select Case (nRecordType)
Case "01"
...
Case "02"
...
Case "03"
Return Part.ValidateColumns(_lstFields)
End Select
Because I'm not making an instance of it and not calling a constructor, there's no way to autopopulate a Dictionary. And I don't want to convert to integer so I'm not going to do an array. That is just in case eventually the value gets above 99 and the next value would be A0. I'm trying to think of easy future changes to this and backwards compatability. If you need more explanations, let me know.
Edit 2:
This is what I've done now and I think it should work:
Public Class Part
Private Shared columnCounts As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)
Public Shared Function ValidateColumns(ByRef lstFiels As List(Of String)) As Boolean
InitializeColumnDictionary()
Return lstFields.Count = columnCounts(lstFields(1))
End Function
Private Shared Sub InitializeColumnDictionary()
columnCounts.Add("01", 39)
End Sub
End Class
I'm not at a point where I can test it right now so I can't verify that it's going to do what I want to, but it doesn't give me an error when I build it so I'm crossing my fingers.