The Labs \ Source Viewer \ SSCLI \ System.Net \ NestedMultipleAsyncResult

  1. //------------------------------------------------------------------------------
  2. // <copyright file="_NestedMultipleAsyncResult.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Net
  16. {
  17.    
  18.     //
  19.     // The NestedAsyncResult - used to wrap async requests
  20.     // this is used to hold another async result made
  21.     // through a call to another Begin call within.
  22.     //
  23.     internal class NestedMultipleAsyncResult : LazyAsyncResult
  24.     {
  25.         //
  26.         // this is usually for operations on streams/buffers,
  27.         // we save information passed in on the Begin call:
  28.         // since some calls might need several completions, we
  29.         // need to save state on the user's IO request
  30.         //
  31.         internal BufferOffsetSize[] Buffers;
  32.         internal int Size;
  33.        
  34.         //
  35.         // Constructor:
  36.         //
  37.         internal NestedMultipleAsyncResult(object asyncObject, object asyncState, AsyncCallback asyncCallback, BufferOffsetSize[] buffers) : base(asyncObject, asyncState, asyncCallback)
  38.         {
  39.             Buffers = buffers;
  40.             Size = 0;
  41.             for (int i = 0; i < Buffers.Length; i++) {
  42.                 Size += Buffers[i].Size;
  43.             }
  44.         }
  45.        
  46.     }
  47.     // class NestedMultipleAsyncResult
  48. }
  49. // namespace System.Net

Developer Fusion