#warning directive in VB.net

老子叫甜甜 提交于 2020-01-23 05:31:10

问题


I know the #warning directive does not exist in vb.net... is there anything like it?
I want to be able to throw messages (warnings) at compiler time.


回答1:


As far as I've ever been able to find... no.




回答2:


It's not the same as preprocessor warning, but in the most cases where I need a warning for the user I generate one using the ObsoleteAttribute:

<ObsoleteAttribute("You should no used this method!", False)> Sub MySub() End Sub

However, since it is not the same as a preprocessor warning it will only trigger if someone uses the methode.



来源:https://stackoverflow.com/questions/192822/warning-directive-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!