I'm currently working on a project where a section of the code looks like this:
Select Case oReader.Name
Case "NameExample1"
Me.Elements.NameExample1.Value = oReader.ReadString
....
Case "NameExampleN"
Me.Elements.NameExampleN.Value = oReader.ReadString
....
End Select
It continues on for a while. The code is obviously verbose and it feels like it could be improved. Is there any way to dynamically invoke a property in VB.NET such that something like this can be done:
Dim sReadString As String = oReader.ReadString
Me.Elements.InvokeProperty(sReadString).Value = sReadString