The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ AddingNewEventArgs

  1. //------------------------------------------------------------------------------
  2. // <copyright file="AddingNewEventArgs.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
  16. {
  17.     using System;
  18.     using System.ComponentModel;
  19.     using System.Security.Permissions;
  20.    
  21.     /// <devdoc>
  22.     /// Provides data for an event that signals the adding of a new object
  23.     /// to a list, allowing any event handler to supply the new object. If
  24.     /// no event handler supplies a new object to use, the list should create
  25.     /// one itself.
  26.     /// </devdoc>
  27.     [HostProtection(SharedState = true)]
  28.     public class AddingNewEventArgs : EventArgs
  29.     {
  30.         private object newObject = null;
  31.        
  32.         /// <devdoc>
  33.         /// Initializes a new instance of the <see cref='System.ComponentModel.AddingNewEventArgs'/> class,
  34.         /// with no new object defined.
  35.         /// </devdoc>
  36.         public AddingNewEventArgs() : base()
  37.         {
  38.         }
  39.        
  40.         /// <devdoc>
  41.         /// Initializes a new instance of the <see cref='System.ComponentModel.AddingNewEventArgs'/> class,
  42.         /// with the specified object defined as the default new object.
  43.         /// </devdoc>
  44.         public AddingNewEventArgs(object newObject) : base()
  45.         {
  46.             this.newObject = newObject;
  47.         }
  48.        
  49.         /// <devdoc>
  50.         /// Gets or sets the new object that will be added to the list.
  51.         /// </devdoc>
  52.         public object NewObject {
  53.             get { return newObject; }
  54.            
  55.             set { newObject = value; }
  56.         }
  57.     }
  58. }

Developer Fusion