Click here to Skip to main content
15,885,899 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Preventing stubbed methods from being released

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
14 Oct 2011CPOL 7.2K   1   1
Nice tip! I'm also a proponent of using your friend the preprocessor to stop you from making big mistakes, along with your best friend, the compiler.You can combine both using this alternative code:private bool ValidateUserDetails(string userName, string password){ //TODO: Default value...

Nice tip! I'm also a proponent of using your friend the preprocessor to stop you from making big mistakes, along with your best friend, the compiler.


You can combine both using this alternative code:


C#
private bool ValidateUserDetails(string userName, string password)
{
  //TODO: Default value used for stub - implement this later
  #warning Not Implemented
  return true;
}

with the option "treat warnings as errors" in Release mode.


That has the big advantage of still showing something in the build results when building in Debug, thus inciting your team to go fix the issue before the time comes to make Release builds.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Frontier Developments
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 5 good tip Pin
Roman_wolf15-Oct-11 6:09
Roman_wolf15-Oct-11 6:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.