Possible duplicate:Why are the properties of the C # collection not marked obsolete when properties are called on them?
I would like to apply ObsoleteAttribute to the property, but it seems that the compiler generates warnings / errors only for direct use of the attribute, any indirect use is ignored.
I think the following example illustrates the problem very well:
using System; class Program { static void Main(string[] args) { var o = new Old(); Console.WriteLine(o.Geezer); // compilation fails: 'ObsoleteAttributeTest.Program.Old.Geezer' is obsolete: 'Some error' Console.WriteLine(o.Geezer.Attributes); // compiles OK } class Old { [ObsoleteAttribute("Some error", true)] public System.Xml.XmlElement Geezer { get { return null; } } } }
I believe this is a known bug in the latest C # compiler (C # 3.0). There is fooobar.com/questions/388600 / ... related to this problem.
var o = new Old(); . CS0246: "var" ( using ?) Old o = new Old(); , CS0619: "Program.Old.Geezer" : " " , , ..!!!!!!!!!!
Source: https://habr.com/ru/post/1704593/More articles:Quickly display session id in .JSP? - java-eeWhy do additional class attributes in VB.NET have weird syntax? - .netКак вызвать указатель функции-члена с помощью указателя на постоянный объект? - c++Facebook Connect + restful_authentication - ruby | fooobar.comWPF DataGrid Button Column Disabled - wpfHow to determine the file type in Linux? - linuxHow to set checked value for radio input tag using ASP.Net? - javascriptПринимая значение NULL из базы данных и присваивая переменной Date - dateUsing Rhino Mocks, How to Set a Parameter Property for a Mocked Method - syntaxДоступ к другому майбоксу в Outlook с помощью vba - vbaAll Articles