>Module SecurityTest > <System.Runtime.CompilerServices.Extension()> _ > Public Function IncludesAnyOf(ByVal sc As e_SecurityCodes, ByVal DocSecurityValue As e_SecurityCodes) As Boolean > Dim code As e_SecurityCodes > For Each code In [Enum].GetValues(GetType(e_SecurityCodes)) > If sc.HasFlag(code) And DocSecurityValue.HasFlag(code) Then > Return True > End If > Next > Return False > End Function >End Module > >... > > Dim param As e_SecurityCodes = e_SecurityCodes.DMS_Accounting_AP Or e_SecurityCodes.DMS_Client > Dim result_Match = (From x In result_0 Where x.SecurityCode.IncludesAnyOf(param) Select x).ToList()>I am now getting the following error on the last dim command:
>'IncludesAnyOf' is not a member of 'Integer?'>Ofcourse the field x.SecurityCode is integer - so how do you attach a method to that field?
SecurityCode = DirectCast(z.SecurityCode,e_SecurityCodes)
and reverse cast it back to an integer when writing to storage if neccessary. That way you'll be dealing with instances of e_SecurityCodes throughout the app rather than relying on 'magic number' integers.