Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4538292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:47:32+00:00 2026-05-21T14:47:32+00:00

My instant messaging library takes advantage of the Begin/End asynchronous pattern for most (if

  • 0

My instant messaging library takes advantage of the Begin/End asynchronous pattern for most (if not all) communications sent across a socket which wait for an acknowledgement.

As such, I find myself implementing IAsyncResult for quite a large number of operations. (ChangeNicknameOperation, SendMessageOperation, AddUserOperation etc..)

I decided to create a base class for my async operations called AsyncOperationBase, which contains the standard implementation of IAsyncResult, including methods to set the operation as complete.

Is this a common practice? I feel like it’s a little unnecessary given that the code being repeated is rather minimal.

Also, when calling the AsyncResult’s callback, is it recommended to call it on another thread, or is it perfectly legitimate to call on the thread which completes the operation?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:47:32+00:00Added an answer on May 21, 2026 at 2:47 pm

    For your problem the new async/await kewords in C# 5 would be the best solution. But until it is released it is fine to go with a base class. To back up my claim I have looked with Reflector at the classes that do implement IAsyncResult in the BCL and there is one big base clas called System.Net.LazyAsyncResult from which 20 other classes derive from. So yes it is a good practice and it will only get easier until we have C# 5.

    Here is the list of classes that derive from LazyAsyncResult:

    internal class System.Net.ContextAwareResult
    internal class System.Net.ListenerClientCertAsyncResult
    internal class System.Net.ListenerAsyncResult
    internal class System.Net.HttpRequestStream/HttpRequestStreamAsyncResult
    internal class System.Net.HttpResponseStreamAsyncResult
    internal class System.Net.NestedMultipleAsyncResult
    internal class System.Net.NestedSingleAsyncResult
    internal class System.Net.WorkerAsyncResult
    internal class System.Net.Cache.CombinedReadStream/InnerAsyncResult
    internal class System.Net.Cache.ForwardingReadStream/InnerAsyncResult
    internal class System.Net.BufferAsyncResult
    internal class System.Net.Base64Stream/ReadAsyncResult
    internal class System.Net.Base64Stream/WriteAsyncResult
    internal class System.Net.BufferedReadStream/ReadAsyncResult
    internal class System.Net.Mime.MimeBasePart/MimePartAsyncResult
    internal class System.Net.Mime.MultiAsyncResult
    internal class System.Net.Mime.QuotedPrintableStream/WriteAsyncResult
    internal class System.Net.Mail.SmtpConnection/ConnectAndHandshakeAsyncResult
    internal class System.Net.Mail.SmtpReplyReaderFactory/ReadLinesAsyncResult
    internal class System.Net.Mail.SendMailAsyncResult
    

    Yours,
    Alois Kraus

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am programming an instant messaging library for MSN Messenger, and I have a
I'm looking for an Instant Messaging library that at minimum supports YM, MSN protocol
I want to use libgadu (library of instant messaging protocol) under Visual Studio 2008.
I'm using OpenFire server for instant messaging and JSJaC JavaScript library on the client.
I recently created a ajax based instant messaging application and after running for a
I want to build instant messaging notification on my ASP.NET MVC (C#) web aplication.
How do i get the instant messaging addresses from iphone contacts in my application
I've implemented a web based instant messaging / chat feature using http binding and
Want to build an web based Instant Messaging system similar to www.chatzy.com The question
My app has an instant messaging feature. So it has a contact list.. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.