The Labs \ Source Viewer \ SSCLI \ System \ ObsoleteAttribute

  1. // ==++==
  2. //
  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. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Class:  ObsoleteAttribute
  18. **
  19. **
  20. ** Purpose: Attribute for functions, etc that will be removed.
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System
  25. {
  26.    
  27.     using System;
  28.     using System.Runtime.Remoting;
  29.     // This attribute is attached to members that are not to be used any longer.
  30.     // Message is some human readable explanation of what to use
  31.     // Error indicates if the compiler should treat usage of such a method as an
  32.     // error. (this would be used if the actual implementation of the obsolete
  33.     // method's implementation had changed).
  34.     //
  35.     [Serializable(), AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate, Inherited = false)]
  36.     [System.Runtime.InteropServices.ComVisible(true)]
  37.     public sealed class ObsoleteAttribute : Attribute
  38.     {
  39.         private string _message;
  40.         private bool _error;
  41.        
  42.         public ObsoleteAttribute()
  43.         {
  44.             _message = null;
  45.             _error = false;
  46.         }
  47.        
  48.         public ObsoleteAttribute(string message)
  49.         {
  50.             _message = message;
  51.             _error = false;
  52.         }
  53.        
  54.         public ObsoleteAttribute(string message, bool error)
  55.         {
  56.             _message = message;
  57.             _error = error;
  58.         }
  59.        
  60.         public string Message {
  61.             get { return _message; }
  62.         }
  63.        
  64.         public bool IsError {
  65.             get { return _error; }
  66.         }
  67.        
  68.     }
  69. }

Developer Fusion