I tried to cut out the middle man by using SELECT DISTINCT … and returning a List, but I couldn’t get that to work, so I ended up getting all the vals and then putting them in a HashSet, which will ignore/not accept duplicate values:
public async Task<HashSet<String>> SelectDistinctGroupNames()
{
var db = new SQLiteAsyncConnection(SQLitePath);
var allLocations = await db.QueryAsync<SOs_Locations>("SELECT * FROM SOs_Locations");
HashSet<string> hashsetGroupNames = null;
foreach (var item in allLocations)
{
hashsetGroupNames.Add(item.GroupName);
}
return hashsetGroupNames;
}
There must be a better way; does anybody know what, though? Maybe a LINQ way to accomplish it?
How about something like this:
This will perform the Distinct operation at the database end, which is far more efficient than fetching all the data from the database and processing it at the client.