Last active
March 24, 2017 08:11
-
-
Save benoitjadinon/379f97128b401022c059 to your computer and use it in GitHub Desktop.
Blocking TODO
This file contains hidden or 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
| using System.Diagnostics; | |
| using System.Runtime.CompilerServices; | |
| // ReSharper disable once CheckNamespace | |
| // ReSharper disable once InconsistentNaming | |
| public static class TODO | |
| { | |
| #if DEBUG | |
| // for mandatory TODOs, will break release compilation AND remind when debugging | |
| public static void BeforeRelease (string whatsLeftToDo = null, [CallerMemberName] string callerName = null) | |
| => RemindMe(whatsLeftToDo, callerName); | |
| #endif | |
| // for non mandatory implementations, will only break when debugging | |
| public static void RemindMe (string whatsLeftToDo = null, [CallerMemberName] string callerName = null) | |
| { | |
| Log(string.Format("TODO [{0}] {1}", callerName ?? "Reminder", whatsLeftToDo ?? "")); | |
| if (Debugger.IsAttached) | |
| Debugger.Break(); | |
| } | |
| public static void Log (string whatsLeftToDo) | |
| { | |
| #if __ANDROID__ | |
| global::Android.Util.Log.Verbose("TODO", whatsLeftToDo); | |
| #elif DEBUG | |
| System.Diagnostics.Debug.WriteLine(whatsLeftToDo); | |
| #else | |
| System.Console.WriteLine (whatsLeftToDo); | |
| #endif | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment