Hi,
I am trying to find a quicker way to search through a large number of colors and get their associated ID values. Generally the code is listed below and it works fine but is unfortunately quite slow. I guess I need to sort the list somehow first and then search it (.NET binarysearch?)
Does anyone have any suggestions please?
Many thanks for any assistance!
Public Class MyColor
Public Property ID As Integer
Public Property RGB As Color
End Class
Dim allMyColors As List(Of MyColor) = New List(Of MyColor)
Dim mc As MyColor = allMyColors.FirstOrDefault(Function(colorage) colorage.RGB.R = R And colorage.RGB.G = G And colorage.RGB.B = B)
If mc IsNot Nothing Then
Return mc.ID
Else
Return 0
End If