用户定义的编译器警告或C#中的错误

Mar*_*ser 3 c# compiler-errors compiler-warnings

是否有可能让一些代码让编译器生成编译警告或错误?

也许有属性?

**有了第一个答案和一些评论,我意识到我的问题并不像我预期的那样清晰,并希望它成为现实.我道歉.希望所有的贡献者仍然和我们在一起.
**

所以我更期待内部DSL.

某事物 喜欢

[MustAssign]
public string Val {get; set;]
Run Code Online (Sandbox Code Playgroud)

Com*_*hip 6

你的意思是#warning

#warning允许您从代码中的特定位置生成一级警告.例如:

#warning Deprecated code in this method.
Run Code Online (Sandbox Code Playgroud)

而对于错误,有(你永远不会猜),#error.