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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="ListBindableAttribute.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>[To be supplied.]</para>
  26.     /// </devdoc>
  27.     [AttributeUsage(AttributeTargets.All)]
  28.     public sealed class ListBindableAttribute : Attribute
  29.     {
  30.         /// <devdoc>
  31.         /// <para>[To be supplied.]</para>
  32.         /// </devdoc>
  33.         public static readonly ListBindableAttribute Yes = new ListBindableAttribute(true);
  34.        
  35.         /// <devdoc>
  36.         /// <para>[To be supplied.]</para>
  37.         /// </devdoc>
  38.         public static readonly ListBindableAttribute No = new ListBindableAttribute(false);
  39.        
  40.         /// <devdoc>
  41.         /// <para>[To be supplied.]</para>
  42.         /// </devdoc>
  43.         public static readonly ListBindableAttribute Default = Yes;
  44.        
  45.         private bool listBindable = false;
  46.         private bool isDefault = false;
  47.        
  48.         /// <devdoc>
  49.         /// <para>[To be supplied.]</para>
  50.         /// </devdoc>
  51.         public ListBindableAttribute(bool listBindable)
  52.         {
  53.             this.listBindable = listBindable;
  54.         }
  55.        
  56.         /// <devdoc>
  57.         /// <para>[To be supplied.]</para>
  58.         /// </devdoc>
  59.         public ListBindableAttribute(BindableSupport flags)
  60.         {
  61.             this.listBindable = (flags != BindableSupport.No);
  62.             this.isDefault = (flags == BindableSupport.Default);
  63.         }
  64.        
  65.         /// <devdoc>
  66.         /// <para>[To be supplied.]</para>
  67.         /// </devdoc>
  68.         public bool ListBindable {
  69.             get { return listBindable; }
  70.         }
  71.        
  72.         /// <devdoc>
  73.         /// <para>[To be supplied.]</para>
  74.         /// </devdoc>
  75.         public override bool Equals(object obj)
  76.         {
  77.             if (obj == this) {
  78.                 return true;
  79.             }
  80.            
  81.             ListBindableAttribute other = obj as ListBindableAttribute;
  82.             return other != null && other.ListBindable == listBindable;
  83.         }
  84.        
  85.         /// <devdoc>
  86.         /// <para>
  87.         /// Returns the hashcode for this object.
  88.         /// </para>
  89.         /// </devdoc>
  90.         public override int GetHashCode()
  91.         {
  92.             return base.GetHashCode();
  93.         }
  94.        
  95.        
  96.         /// <devdoc>
  97.         /// <para>[To be supplied.]</para>
  98.         /// </devdoc>
  99.         public override bool IsDefaultAttribute()
  100.         {
  101.             return (this.Equals(Default) || isDefault);
  102.         }
  103.     }
  104. }

Developer Fusion