Created
September 12, 2018 21:10
-
-
Save PhiHuyHoang/7b68895b3d59229a2029899924064677 to your computer and use it in GitHub Desktop.
method constructor function example 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
Action<string> logMethods; | |
public void AddLogMethod(Action<string> newLogMethod) | |
{ | |
logMethods += newLogMethod; | |
} | |
public void LogThis(string msg) | |
{ | |
logMethods?.Invoke($"[{DateTime.Now.ToLongDateString()}] {msg}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment