Dim param As e_SecurityCodes = e_SecurityCodes.DMS_Accounting_PR>I might start another thread tomorow depending if i can figure out how to dynamicly create the enum structure based on rows in a table - i like keeping things flexible. But i am gonna play around with this for a while.
<Flags()> _ Public Enum E_SecurityCodes DMS_None = 0 DMS_Accounting_AR = 1 DMS_Accounting_AP = 2 DMS_Accounting_PR = 4 DMS_Accounting_All = 7 'Or, if you don't trust your maths, you can use 'DMS_Accounting_All = DMS_Accounting_AR Or DMS_Accounting_AP Or DMS_Accounting_PR DMS_HR_Employee = 8 DMS_HR_Caregiver = 16 DMS_HR_All = 24 DMS_Client = 32 DMS_All = 63 End EnumThis way you use up a lot less ints but, more importantly (assuming I've interpreted your intentions correctly) DMS_Accounting_All will actually include the AR,AP and PR flags, DMS_HR_All will include the Employee and CareGiver options and DMS_All will include all flags. This approach can, for example, simplify your filtering. If you want to filter on records with any accounting flag you can just use :
Dim list= (From x In result_Match Where x.SecurityCodes.IncludeIfAnyOf(DMS_Accounting_All) Select x).ToList()