The Labs \ Source Viewer \ SSCLI \ System.Diagnostics \ MonitoringDescriptionAttribute

  1. //------------------------------------------------------------------------------
  2. // <copyright file="MonitoringDescriptionAttribute.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.Diagnostics
  16. {
  17.    
  18.    
  19.     using System;
  20.     using System.ComponentModel;
  21.    
  22.     /// <devdoc>
  23.     /// DescriptionAttribute marks a property, event, or extender with a
  24.     /// description. Visual designers can display this description when referencing
  25.     /// the member.
  26.     /// </devdoc>
  27.     [AttributeUsage(AttributeTargets.All)]
  28.     public class MonitoringDescriptionAttribute : DescriptionAttribute
  29.     {
  30.        
  31.         private bool replaced = false;
  32.        
  33.         /// <devdoc>
  34.         /// Constructs a new sys description.
  35.         /// </devdoc>
  36.         public MonitoringDescriptionAttribute(string description) : base(description)
  37.         {
  38.         }
  39.        
  40.         /// <devdoc>
  41.         /// Retrieves the description text.
  42.         /// </devdoc>
  43.         public override string Description {
  44.             get {
  45.                 if (!replaced) {
  46.                     replaced = true;
  47.                     DescriptionValue = SR.GetString(base.Description);
  48.                 }
  49.                 return base.Description;
  50.             }
  51.         }
  52.     }
  53. }

Developer Fusion