Fellow coders,
I'm looking for a simpel and fast solution to retrieve some object values in a List(of Object) an then combine those values to a two dimensional array.
Let me talk in code to explain:
Public Class MyMainClass
Dim lstObjects as new list(of TestObject)
Sub New()
lstObjects.Add(new TestObject With {.IndexPos = 2,
.Value1 = 4578,
.Value2 = 9876234)
lstObjects.Add(new TestObject With {.IndexPos = 8,
.Value1 = 45232378,
.Value2 = 98761111234)
RetrieveValues(New Integer() {1, 4, 8}
End Sub
Function RetrieveValues(SearchValues()) as integer (,)
Dim y As IEnumerable(Of TestObject) = Sources.Where(Function(a) a.IndexPos .Equals(SearchValues))
'Then do something here to convert Value1 and Value 2 of the object to a two dimensional array
End function
End Class
Public Class TestObject
Public IndexPos As Integer
Public Value1 As Integer
Public Value2 As Integer
End Class
The code is an example and not tested (written just here in this editor). The TestObject doesn't contain many values here, but in the real applications it has many properties. Hopefully you understand what i'm trying to achieve and could help me out on this. I've spend several hours on google to find a solution...