The Labs \ Source Viewer \ SSCLI \ System.ComponentModel.Design.Serialization \ SerializationStore

  1. //------------------------------------------------------------------------------
  2. // <copyright file="SerializationStore.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.ComponentModel.Design.Serialization
  16. {
  17.    
  18.     using System.Collections;
  19.     using System.ComponentModel;
  20.     using System.IO;
  21.     using System.Security.Permissions;
  22.    
  23.     /// <devdoc>
  24.     /// The SerializationStore class is an implementation-specific class that stores
  25.     /// serialization data for the component serialization service. The
  26.     /// service adds state to this serialization store. Once the store is
  27.     /// closed it can be saved to a stream. A serialization store can be
  28.     /// deserialized at a later date by the same type of serialization service.
  29.     /// SerializationStore implements the IDisposable interface such that Dispose
  30.     /// simply calls the Close method. Dispose is implemented as a private
  31.     /// interface to avoid confusion. The IDisposable pattern is provided
  32.     /// for languages that support a "using" syntax like C# and VB .NET.
  33.     /// </devdoc>
  34.     [HostProtection(SharedState = true)]
  35.     public abstract class SerializationStore : IDisposable
  36.     {
  37.        
  38.         /// <devdoc>
  39.         /// If there were errors generated during serialization or deserialization of the store, they will be
  40.         /// added to this collection.
  41.         /// </devdoc>
  42.         public abstract ICollection Errors {
  43.             get;
  44.         }
  45.        
  46.         /// <devdoc>
  47.         /// The Close method closes this store and prevents any objects
  48.         /// from being serialized into it. Once closed, the serialization store may be saved.
  49.         /// </devdoc>
  50.         public abstract void Close();
  51.        
  52.         /// <devdoc>
  53.         /// The Save method saves the store to the given stream. If the store
  54.         /// is open, Save will automatically close it for you. You
  55.         /// can call save as many times as you wish to save the store
  56.         /// to different streams.
  57.         /// </devdoc>
  58.         public abstract void Save(Stream stream);
  59.        
  60.         /// <devdoc>
  61.         /// Disposes this object by calling the Close method.
  62.         /// </devdoc>
  63.         void IDisposable.Dispose()
  64.         {
  65.             Dispose(true);
  66.         }
  67.        
  68.         protected virtual void Dispose(bool disposing)
  69.         {
  70.             if (disposing)
  71.                 Close();
  72.         }
  73.     }
  74. }

Developer Fusion