I've recently asked a question. And it immediately started to get downvotes without any comment explaining what is wrong with it? If there is something wrong, I want to correct it and learn from my mistakes.
1 Answer
General rule is to read intently SO help section about scope of the questions and recommendations of how to create them. It's all written down long ago and most active contributors have read that many times.
Direct links:
- https://stackoverflow.com/help/on-topic
- https://stackoverflow.com/help/dont-ask
- https://stackoverflow.com/help/how-to-ask
(although I would recommend to read the whole help section, you will feel much more confident after that)
So, quoting from there,
if your question generally covers…
- a specific programming problem, or
- a software algorithm, or
- software tools commonly used by programmers; and is
- a practical, answerable problem that is unique to software development
… then you’re in the right place to ask your question!
Your question can only possibly belong to the first category, but in this case it's not really clear what is your specific programming problem.
Questions without a clear problem statement are not useful to other readers
and:
You should only ask practical, answerable questions based on actual problems that you face.
You're asking about performance differences (why do you need to know that?), but after intently reading the question, I would say you really want to know how to correctly expose async methods into sync code. Is there a safe way to do it?
describe the problem and what has been done so far to solve it
I would say you've got sync code and async code in your app. Some code is shared between them. So you found two ways of combining async code and sync code and now you're trying to find a difference between them to decide which should be used. (consider how much I had to assume and infer that you haven't stated clearly in your question)
Now this is:
- A rather general question about combining sync and async code in C#
- Question that already has answers e.g. here: How to safely mix sync and async code? (note how the person who asked clearly stated his specific problem and indicated that he has done some research into the topic)
function
keyword which is not in C#. Also, the question doesn't show any research effort, I think I can whip up a couple of potential duplicates with one Google query. Then you ask "Is there a performance difference between these two?", which is generally frowned upon, see also Which is faster?.