1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 /*============================================================
6 **
7 **
8 **
9 ** Purpose: Attribute for functions, etc that will be removed.
10 **
11 **
12 ===========================================================*/
13 
14 using System;
15 
16 namespace System
17 {
18     // This attribute is attached to members that are not to be used any longer.
19     // Message is some human readable explanation of what to use
20     // Error indicates if the compiler should treat usage of such a method as an
21     //   error. (this would be used if the actual implementation of the obsolete
22     //   method's implementation had changed).
23     //
24     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum |
25         AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate
26         , Inherited = false)]
27     public sealed class ObsoleteAttribute : Attribute
28     {
29         private String _message;
30         private bool _error;
31 
ObsoleteAttribute()32         public ObsoleteAttribute()
33         {
34             _message = null;
35             _error = false;
36         }
37 
ObsoleteAttribute(String message)38         public ObsoleteAttribute(String message)
39         {
40             _message = message;
41             _error = false;
42         }
43 
ObsoleteAttribute(String message, bool error)44         public ObsoleteAttribute(String message, bool error)
45         {
46             _message = message;
47             _error = error;
48         }
49 
50         public String Message
51         {
52             get { return _message; }
53         }
54 
55         public bool IsError
56         {
57             get { return _error; }
58         }
59     }
60 }
61