Cannot await 'Model.PersonalInfo'

Posted by Gooftroop on Stack Overflow See other posts from Stack Overflow or by Gooftroop
Published on 2013-06-30T22:02:16Z Indexed on 2013/06/30 22:21 UTC
Read the original article Hit count: 365

Filed under:
|
|

I have the following method in a DesignDataService class

public async Task<T> GetData<T>(T dataObject)
{
    var typeName = typeof(T).Name;    
    switch (typeName)
    {
        case "PersonalInfo":
            var person =  new PersonalInfo
                     {
                     FirstName = "Mickey",
                     LastName = "Mouse" ,
                     Adres = new Address{Country="DLRP"} ,
                };
        return await person;

    }   // end Switch

}   // GetData<T>

How can I return a new PersonalInfo class from the DataService?

For now I get the error Cannot await 'Model.PersonalInfo'

Even when I change the return statement as follows return await person as Task; the error stays the same

Thanks in advanced

Danny

© Stack Overflow or respective owner

Related posts about c#

Related posts about asynchronous