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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="DefaultBindingPropertyAttribute.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. /*
  16. */
  17. namespace System.ComponentModel
  18. {
  19.     using System;
  20.     using System.Diagnostics;
  21.     using System.Security.Permissions;
  22.    
  23.     /// <devdoc>
  24.     /// <para>Specifies the default binding property for a component.</para>
  25.     /// </devdoc>
  26.     [AttributeUsage(AttributeTargets.Class)]
  27.     public sealed class DefaultBindingPropertyAttribute : Attribute
  28.     {
  29.        
  30.         private readonly string name;
  31.        
  32.         /// <devdoc>
  33.         /// <para>
  34.         /// Initializes a new instance of
  35.         /// the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/> class.
  36.         /// </para>
  37.         /// </devdoc>
  38.         public DefaultBindingPropertyAttribute()
  39.         {
  40.             this.name = null;
  41.         }
  42.        
  43.         /// <devdoc>
  44.         /// <para>
  45.         /// Initializes a new instance of
  46.         /// the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/> class.
  47.         /// </para>
  48.         /// </devdoc>
  49.         public DefaultBindingPropertyAttribute(string name)
  50.         {
  51.             this.name = name;
  52.         }
  53.        
  54.         /// <devdoc>
  55.         /// <para>
  56.         /// Gets the name of the default binding property for the component this attribute is
  57.         /// bound to.
  58.         /// </para>
  59.         /// </devdoc>
  60.         public string Name {
  61.             get { return name; }
  62.         }
  63.        
  64.         /// <devdoc>
  65.         /// <para>
  66.         /// Specifies the default value for the <see cref='System.ComponentModel.DefaultBindingPropertyAttribute'/>, which is <see langword='null'/>. This
  67.         /// <see langword='static '/>field is read-only.
  68.         /// </para>
  69.         /// </devdoc>
  70.         public static readonly DefaultBindingPropertyAttribute Default = new DefaultBindingPropertyAttribute();
  71.        
  72.         public override bool Equals(object obj)
  73.         {
  74.             DefaultBindingPropertyAttribute other = obj as DefaultBindingPropertyAttribute;
  75.             return other != null && other.Name == name;
  76.         }
  77.        
  78.         public override int GetHashCode()
  79.         {
  80.             return base.GetHashCode();
  81.         }
  82.     }
  83. }

Developer Fusion