Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 3
    I question the return type void here, you're creating fire and forget methods? How do you know when it has completed the write operation? Seems like a recipe for disaster to me. Commented Apr 25, 2014 at 8:41
  • Naming is probably subjective. But it is bad practice to create void async methods: theburningmonk.com/2012/10/c-beware-of-async-void-in-your-code Commented Apr 25, 2014 at 8:43
  • 1
    To be consistent with .Net framework conventions use BeginXXX and EndXXX naming.. Also your method doesn't adhere APM It should return IAsyncResult Commented Apr 25, 2014 at 8:44
  • It is just an example to illustrate the point. You could, for example, add an Action parameter that will run when the End... method is invoked. Commented Apr 25, 2014 at 8:50
  • 1
    I think the problem here is that the moniker Async on a method means that it has some kind of asynchronous notification mechanism when the operation it starts has completed. For me that means that in order for the method to be named Async, there must be some kind of callback mechanism. However, I would say no, don't name it like this. Either supply the standard IAsyncResult parameters and create BeginXXX and EndXXX, or use Task and call it Async, or find your own naming conventions for your different style. But this is just an opinion! Commented Apr 25, 2014 at 8:52