Im trying to understand the basics of async/await by creating a simple example. Im using Sqlite with an Async connection and I have a class like this:
public class User
{
public int Id { get; set; }
public string Name { get; set; }
}
Now lets say that I want to save a User
to my UserTable and when the saving is done I wish to retrieve it.
public async ? SaveToDb()
{
_conn.CreateTableAsync<User>();
await _conn.InsertAsync(new User(){Id=1, Name = "Bill"});
//Code that waits for the save to complete and then retrieves the user
}
I suspect that I need a task somewhere, but im not completely sure how to do this. Thank you