I have a select case that checks against a string variable. It's starting to get large and I am wondering if there is a better way of doing this?
Here is a sample of the Select Case
statement:
Select Case Param.ToLower
Case "dashboard_home_vm"
Return _Locator.DashboardHome_VM
Case "job_list_vm"
Return _Locator.JobList_VM
Case "job_add_vm"
Return _Locator.JobAdd_VM
Case "client_add_vm"
Return _Locator.ClientAdd_VM
Case "client_list_vm"
Return _Locator.ClientList_VM
Case "client_report_vm"
Return _Locator.ClientReport_VM
Case "employee_add_vm"
Return _Locator.EmployeeAdd_VM
Case "employee_certification_vm"
Return _Locator.EmployeeCertification_VM
Case "employee_list_vm"
Return _Locator.EmployeeList_VM
Case "employee_report_vm"
Return _Locator.EmployeeReport_VM
Case "employee_role_vm"
Return _Locator.EmployeeRole_VM
Case "employee_timeslip_vm"
Return _Locator.EmployeeTimeslip_VM
Case "product_add_vm"
Return _Locator.ProductAdd_VM
Case "product_category_vm"
Return _Locator.ProductCategory_VM
Case "product_list_vm"
Return _Locator.ProductList_VM
Case "product_type_vm"
Return _Locator.ProductType_VM
Case "product_unit_vm"
Return _Locator.ProductUnit_VM
Case "tracking_stock_vm"
Return _Locator.TrackingInStock_VM
Case "tracking_list_vm"
Return _Locator.TrackingList_VM
Case "tracking_site_vm"
Return _Locator.TrackingOnSite_VM
Case "vendor_add_vm"
Return _Locator.VendorAdd_VM
Case "vendor_list_vm"
Return _Locator.VendorList_VM
Case "vendor_report_vm"
Return _Locator.VendorReport_VM
Case Else
Return Nothing
End Select
This actual list will be about 50 - 80 comparisons. Is this the fastest way to do this or is there a better way?