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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="ComplexBindingPropertiesAttribute.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.ComponentModel;
  21.     using System.Diagnostics;
  22.     using System.Security.Permissions;
  23.    
  24.     /// <devdoc>
  25.     /// <para>Specifies the data source and data member properties for a component.</para>
  26.     /// </devdoc>
  27.     [AttributeUsage(AttributeTargets.Class)]
  28.     public sealed class ComplexBindingPropertiesAttribute : Attribute
  29.     {
  30.        
  31.         private readonly string dataSource;
  32.         private readonly string dataMember;
  33.        
  34.         /// <devdoc>
  35.         /// <para>
  36.         /// Initializes a new instance of
  37.         /// the <see cref='System.ComponentModel.ComplexBindingPropertiesAttribute'/> class.
  38.         /// </para>
  39.         /// </devdoc>
  40.         public ComplexBindingPropertiesAttribute()
  41.         {
  42.             this.dataSource = null;
  43.             this.dataMember = null;
  44.         }
  45.        
  46.         /// <devdoc>
  47.         /// <para>
  48.         /// Initializes a new instance of
  49.         /// the <see cref='System.ComponentModel.ComplexBindingPropertiesAttribute'/> class.
  50.         /// </para>
  51.         /// </devdoc>
  52.         public ComplexBindingPropertiesAttribute(string dataSource)
  53.         {
  54.             this.dataSource = dataSource;
  55.             this.dataMember = null;
  56.         }
  57.        
  58.         /// <devdoc>
  59.         /// <para>
  60.         /// Initializes a new instance of
  61.         /// the <see cref='System.ComponentModel.ComplexBindingPropertiesAttribute'/> class.
  62.         /// </para>
  63.         /// </devdoc>
  64.         public ComplexBindingPropertiesAttribute(string dataSource, string dataMember)
  65.         {
  66.             this.dataSource = dataSource;
  67.             this.dataMember = dataMember;
  68.         }
  69.        
  70.         /// <devdoc>
  71.         /// <para>
  72.         /// Gets the name of the data source property for the component this attribute is
  73.         /// bound to.
  74.         /// </para>
  75.         /// </devdoc>
  76.         public string DataSource {
  77.             get { return dataSource; }
  78.         }
  79.        
  80.         /// <devdoc>
  81.         /// <para>
  82.         /// Gets the name of the data member property for the component this attribute is
  83.         /// bound to.
  84.         /// </para>
  85.         /// </devdoc>
  86.         public string DataMember {
  87.             get { return dataMember; }
  88.         }
  89.        
  90.         /// <devdoc>
  91.         /// <para>
  92.         /// Specifies the default value for the <see cref='System.ComponentModel.ComplexBindingPropertiesAttribute'/>, which is <see langword='null'/>. This
  93.         /// <see langword='static '/>field is read-only.
  94.         /// </para>
  95.         /// </devdoc>
  96.         public static readonly ComplexBindingPropertiesAttribute Default = new ComplexBindingPropertiesAttribute();
  97.        
  98.         public override bool Equals(object obj)
  99.         {
  100.             ComplexBindingPropertiesAttribute other = obj as ComplexBindingPropertiesAttribute;
  101.             return other != null && other.DataSource == dataSource && other.DataMember == dataMember;
  102.         }
  103.        
  104.         public override int GetHashCode()
  105.         {
  106.             return base.GetHashCode();
  107.         }
  108.     }
  109. }

Developer Fusion