Created
May 8, 2015 02:18
-
-
Save waf/2a4f0140a4fd5491ef1b to your computer and use it in GitHub Desktop.
Expiring TODOs in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ExpiringTodos | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Hello"); | |
Todo.By(2015, 04, 15, "A general hello is good enough, but we're including 'World' here for compatibility reasons."); | |
Console.WriteLine("World"); | |
Console.ReadKey(); | |
} | |
} | |
class Todo | |
{ | |
[Conditional("DEBUG")] // only run in DEBUG mode, calls to this method are removed by the compiler in RELEASE mode. | |
internal static void By(int year, int month, int day, string message) | |
{ | |
if (DateTime.Now.Date > new DateTime(year, month, day)) | |
{ | |
throw new Exception("A TODO needs to be addressed: " + message); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment