Share via

Asynchronous Methods

Ronald Rex 1,671 Reputation points
2023-07-24T14:06:35.58+00:00

I have some Func Delegates that query a database. For example

public List<Model> GetEmployees()

{

string sql=.....

var output=_db.LoadData<Model, ......

return output;

}

My question is, to make this Method asyncronous should I make it a Task or just use the keyword async in the signature? Thanks !!

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Bruce (SqlWork.com) 84,086 Reputation points
2023-07-24T14:43:25.9866667+00:00

asyncronous methods return a task. The async keyword is used when an async method warn to use the await keyword.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.