tags:

views:

118

answers:

2

Duplicate

Custom Compiler Warnings in .NET

I'd like to be able to tag my code with a NotImplementedAttribute and have the compiler either give a warning or an error at build time if the method is used.

I know there is the ObsoleteAttribute, but that communicates something very different.

A: 

There's no way you can do anything similar to ObsoleteAttribute. Howerver, you can add #warning directive to your code, so that compiler will emit a warning. However, it will be there until you remove the directive.

Anton Gogolev
+1  A: 

This has been discussed here:

http://stackoverflow.com/questions/154109/custom-compiler-warnings

Jim Harte