Attribute for code marking

C # has attributes such as [deprecated] that generate compiler warnings that will be shown in visual studio.

Is there an attribute that I can use to mark a method or class with a comment that should appear as a warning in visual studio when compiling?

Sort of:

[TBD(Msg="Please change me after 2010 07 20")]
public void Foo(){
}

or is it likely that I can get from System.Attribute and make my own attribute by setting up the visual studio so that it behaves as I described.

UPDATE

Thanks to everyone for your answers. I accepted the answer from Robaticus because it showed me the solution that I really need:

#warning Message

shows the desired message that I wanted, and it does it without any overhead. Thank!

. , , , . , , .

+3
2

:

#warning Please change this code after 2010 07 20
+3

, .

//Compiling error
[System.Obsolete("Obsolete use blah instead", true)]


//Compiling warning
[System.Obsolete("Obsolete use blah instead", false)]
+7

Source: https://habr.com/ru/post/1749815/


All Articles