I am on a different computer from yesterday, took the code I posted and created a new console app, ran it and it works as expected.
Code:
Module Module1
Private MyQuestions As New List(Of Question)
Sub Main()
LoadItems()
Dim Current = MyQuestions.Item(MyRandomNumber)
Console.WriteLine("Question: {0}", Current.Text)
Console.WriteLine("Answer: {0}", Current.Response)
Console.WriteLine("press any key to exit...")
Console.ReadLine()
End Sub
''' <summary>
''' Mocked function to simulate a random number but is static
''' </summary>
''' <returns></returns>
''' <remarks>
''' </remarks>
Public Function MyRandomNumber() As Integer
Return 2
End Function
Private Sub LoadItems()
MyQuestions.Add(
New Question With
{
.Identifier = 1,
.Text = "Question 1",
.Response = "Answer for question 1"
}
)
MyQuestions.Add(
New Question With
{
.Identifier = 2,
.Text = "Question 2",
.Response = "Answer to middle questions"
}
)
MyQuestions.Add(
New Question With
{
.Identifier = 3,
.Text = "Question 3",
.Response = "Answer to last question"
}
)
End Sub
Public Class Question
Public Property Identifier As Int32
Public Property Text As String
Public Property Response As String
Public Sub New()
End Sub
End Class
End Module