Possible Duplicate:
How to call an async method from a getter or setter?
I'm trying to implement a property that'll use the Sqlite await inside it:
public int ID {
get
{
if (_id != null)
{
return _id;
}
if (string.IsNullOrEmpty(ImageName))
{
return -1;
}
var query = CurrentConnection.Table<Image>().Where(i => i.ImageName == ImageName);
var result = await query.ToListAsync();
...other code
However, since a property is not set to await(tried that, doesn't work), I can't use await inside a property.
Any way to get around this besides using a method instead of a property?