io/attributes/1/obsolete.cs - A reproduction of class ObsoleteAttribute. | Lecture 10 - slide 36 : 40 Program 3 |
// In part, reproduced from the book "C# to the Point" using System; [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)] public sealed class MyObsoleteAttribute: Attribute{ string message; bool isError; public string Message{ get { return message; } } public bool IsError{ get { return isError; } set { isError = value; } } public MyObsoleteAttribute(){ message = ""; isError = false; } public MyObsoleteAttribute(string msg){ message = msg; isError = false; } public MyObsoleteAttribute(string msg, bool error){ message = msg; isError = error; } }