public void GetCurrentMethodGeneric <T> (T t) { var rslt = MethodBaseEx.GetCurrentMethod(); Assert.IsNotNull(rslt, "#1"); Assert.AreEqual(((MethodInfo)(this.GetType().GetCType().GetGenericMethod("GetCurrentMethodGeneric", new string[] { "T" }, new CType[] { typeof(T) }))), rslt, "#2"); }
public void GetCurrentMethodWithOverload() { var rslt = MethodBaseEx.GetCurrentMethod(); Assert.IsNotNull(rslt, "#1"); Assert.AreEqual((MethodBase)this.GetType().GetCType().GetMethod("GetCurrentMethodWithOverload", CTypeExtensions.CTypeEmptyArray), rslt, "#2"); }
public void GetCurrentMethod() { var rslt = MethodBaseEx.GetCurrentMethod(); Assert.IsNotNull(rslt, "#1"); Assert.AreEqual((MethodBase)this.GetType().GetCType().GetMethod("GetCurrentMethod"), rslt, "#2"); }
private void output(string message, LogLevel level) { lock (_sync) { if (_level > level) { return; } LogData data = null; try { data = new LogData(level, #if NETCF MethodBaseEx.GetStackMethodName(2), #else new StackFrame(2, true), #endif message); _output(data, _file); } catch (Exception ex) { data = new LogData(LogLevel.Fatal, #if NETCF MethodBaseEx.GetStackMethodName(0), #else new StackFrame(0, true), #endif ex.Message); #if SSHARP var lines = data.ToString().Split(new[] { "\r\n" }, StringSplitOptions.None); foreach (var line in lines) { if (Debugger.IsAttached) { Debugger.WriteLine(line); } else { CrestronConsole.PrintLine(line); } } #else Console.WriteLine(data.ToString()); #endif } } }
public void GetExceptionMethod() { Exception exception = null; try { ThrowException(); } catch (Exception ex) { exception = ex; } var rslt = MethodBaseEx.GetExceptionMethod(exception); Assert.IsNotNull(rslt, "#1"); Assert.AreEqual((MethodBase)this.GetType().GetCType().GetMethod("ThrowException"), rslt, "#2"); }
private MethodBase ReturnCallingMethod() { return(MethodBaseEx.GetCallingMethod()); }