> Public Function OptionCheck_WithArray(ByRef n_Value1() As Integer, ByVal n_Value2 As Integer) As Boolean > ' TODO: need to loop through array > Return If((n_Value2 And n_Value1(0)) = n_Value1(0), True, False) > End Function>This function will check if a 4 is in 102 (as an example).
> result_0 = result_0.Where(Function(f) OptionCheck_WithArray(SecurityCodes, f.SecurityCode) = True)>but that thoughts an error, don't remember the exact text, but the research of the error reviled that LINQ can not translate that into SQL.
Public Class DummyRow Public Sub New(ByVal codes__1 As List(Of Integer)) Codes = codes__1 End Sub Public Property Codes() As List(Of Integer) Get Return m_Codes End Get Set(ByVal value As List(Of Integer)) m_Codes = Value End Set End Property Private m_Codes As List(Of Integer) End Classthen:
Dim results As New List(Of DummyRow)() results.Add(New DummyRow(New List(Of Integer)() From {1, 4})) results.Add(New DummyRow(New List(Of Integer)() From {4, 8})) results.Add(New DummyRow(New List(Of Integer)() From {4, 16})) Dim ToCheck As SecurityCodes = SecurityCodes.Guest Or SecurityCodes.Affiliate Dim MatchingRows As IEnumerable(Of DummyRow) = From x In results Where ToCheck.IncludesCode(x.Codes) Select x