c# Programming Glossary: methodbase.getcurrentmethod
IQueryable extension method for linq2entities http://stackoverflow.com/questions/10826275/iqueryable-extension-method-for-linq2entities TSource Expression.Call null MethodInfo MethodBase.GetCurrentMethod .MakeGenericMethod new Type typeof TSource new Expression source.Expression..
How to get current property name via reflection? http://stackoverflow.com/questions/1206023/how-to-get-current-property-name-via-reflection Console.ReadLine public string Something get return MethodBase.GetCurrentMethod .Name If you profile the performance you should find MethodBase.GetCurrentMethod.. .Name If you profile the performance you should find MethodBase.GetCurrentMethod is miles faster than StackFrame. In .NET 1.1 you will also have..
How performant is StackFrame? http://stackoverflow.com/questions/1348643/how-performant-is-stackframe using an approach like public void DoSomething TraceCall MethodBase.GetCurrentMethod .Name Do Something public void TraceCall string methodName if.. methodName if loggingEnabled return Log... TraceCall MethodBase.GetCurrentMethod .Name It was simple but regardless of whether or not tracing.. A public void DoSomething if loggingEnabled TraceCall MethodBase.GetCurrentMethod .Name Do Something public void TraceCall string methodName..
Generic logging of function parameters in exception handling http://stackoverflow.com/questions/135782/generic-logging-of-function-parameters-in-exception-handling new NotImplementedException catch Exception ex LogError MethodBase.GetCurrentMethod ex s x y private static void LogError MethodBase method Exception..
.NET: Determine the type of ?œthis??class in its static method http://stackoverflow.com/questions/2081612/net-determine-the-type-of-this-class-in-its-static-method this.GetType for static methods try the following. Type t MethodBase.GetCurrentMethod .DeclaringType Although this is likely much more expensive than..
Why do loggers recommend using a logger per class? http://stackoverflow.com/questions/3143929/why-do-loggers-recommend-using-a-logger-per-class private static readonly ILog _logger LogManager.GetLogger MethodBase.GetCurrentMethod .DeclaringType public void SomeMethod _logger.DebugFormat File..
Dependency injection and named loggers http://stackoverflow.com/questions/3452318/dependency-injection-and-named-loggers private static readonly ILog logger LogManager.GetLogger MethodBase.GetCurrentMethod .DeclaringType Alternatively if my logger is not named for a..
|