lundi 23 mars 2015

Calling Async method in class constructor in C#


Currently I'm developing an universal app using c#.


In app I used sqlite as database and as you may now It has async methods.


I have a class with some null property that I'll fill them using data I fetch from db, but It should be done exactly in class constructor.


The problem is that using async methods is not allowed, So I tried creating a new async method and using sqlite methods and filling properties in it to call it synchronously in constructor, but as may expecting It doesn't work well.


Please guide me, How can I use async method in class constructor o a way to get data from db and fill class properties right in class constructor method


Thanks in advance





Aucun commentaire:

Enregistrer un commentaire