I'm not sure what you are trying to do but
string selection = "Bob";
IEnumerable<Test_SilentDevices> results = silentDevices.Where(tsd => tsd.CUSTOMER_NAME == selection);
Will set the query variable to an
IEnumerable<Test_SilentDevices>
where the
CUSTOMER_NAME
equals 'Bob'. You can enumerate the variable using a
foreach
statement. Alternatively you can return a
List
from the query.
List<Test_SilentDevices> queryList = silentDevices.Where(tsd => tsd.CUSTOMER_NAME == selection).ToList();
There is no need for the
string.IsNullOrWhiteSpace
test. If you want to select just the
DEALER_NAME
property you can add a
Select
statement.
List<string> dealerNamesList = silentDevices.Where(tsd => tsd.CUSTOMER_NAME == selection)
.Select(tsd => tsd.DEALER_NAME).ToList();