Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Preventing stubbed methods from being released

5.00/5 (5 votes)
14 Oct 2011CPOL 7.4K  
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)