CSharpFeeds - All your C# feeds in one place.

Sponsors

Wednesday, January 06, 2010

Not implemented? Implemented.

by Patrik Hägne via Legend and truth on 1/6/2010 11:13:00 AM

I use the System.NotImplementedException a lot, whenever I create a new method I have it throwing this until I have let tests drive actual functionality of the method. There is a slight danger in this though (although better than the alternative) in that I might forget to implement a function and this exception creeps into production.

The other day I modified the snippet I use so that it outputs pre processor directives, so that the compiler will refuse to compile the code if I forget to implement such a method.

#if DEBUG
            throw new NotImplementedException();
#else
#error "Must be implemented to compile in configurations where the DEBUG constant is not defined."
#endif
email it!bookmark it!digg it!

Original Post: Not implemented? Implemented.

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us