Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Update</h2> <p>This is now possible with Roslyn (Visual Studio 2015). You can <a href="https://johnkoerner.com/csharp/creating-your-first-code-analyzer/" rel="nofollow noreferrer">build</a> a <a href="https://github.com/dotnet/roslyn/wiki/How-To-Write-a-C%23-Analyzer-and-Code-Fix" rel="nofollow noreferrer">code analyzer</a> to check for a custom attribute</p> <hr> <p>I don't believe it's possible. ObsoleteAttribute is treated specially by the compiler and is defined in the C# standard. Why on earth is ObsoleteAttribute not acceptable? It seems to me like this is precisely the situation it was designed for, and achieves precisely what you require!</p> <p>Also note that Visual Studio picks up the warnings generated by ObsoleteAttribute on the fly too, which is very useful.</p> <p>Don't mean to be unhelpful, just wondering why you're not keen on using it...</p> <p>Unfortunately ObsoleteAttribute is sealed (probably partly due to the special treatment) hence you can't subclass your own attribute from it.</p> <p>From the C# standard:-</p> <blockquote> <p>The attribute Obsolete is used to mark types and members of types that should no longer be used.</p> <p>If a program uses a type or member that is decorated with the Obsolete attribute, the compiler issues a warning or an error. Specifically, the compiler issues a warning if no error parameter is provided, or if the error parameter is provided and has the value false. The compiler issues an error if the error parameter is specified and has the value true.</p> </blockquote> <p>Doesn't that sum up your needs?... you're not going to do better than that I don't think.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload