Log function calls parameter values & return values in c#
问题 Say I have a class that looks like this. public static class Config { public static string GetAppSetting(string key) { return ConfigurationManager.AppSettings[key].ToString(); } } And I wanted to log every call to this method along with the key parameter & return value. The only code change I want to make is this: [Log] public static class Config { public static string GetAppSetting(string key) { return ConfigurationManager.AppSettings[key].ToString(); } } I'll most likely use log4net to log