Hi,
I use sqlite-net-pcl nuget package in my project. I have the following generic method to load all rows from a table to an ObservableCollection:
ObservableCollection<T> Load<T>() where T : class, new()
{
List<T> items = database.Query<T>("SELECT * FROM ?", typeof(T).Name);
return new ObservableCollection<T>(items);
}
When I try to call it (for example CarList = Load<Car>();
), I get an exception (picture attached)
However the following method works without any problem:
ObservableCollection<Car> LoadCars()
{
List<Car> items = database.Query<Car>("SELECT * FROM Car");
return new ObservableCollection<Car>(items);
}
Does anybody knows, where is the problem?
Thanks for your help.