本文整理汇总了C#中System.Diagnostics.StackTrace.GetFileColumnNumber方法的典型用法代码示例。如果您正苦于以下问题:C# System.Diagnostics.StackTrace.GetFileColumnNumber方法的具体用法?C# System.Diagnostics.StackTrace.GetFileColumnNumber怎么用?C# System.Diagnostics.StackTrace.GetFileColumnNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.StackTrace
的用法示例。
在下文中一共展示了System.Diagnostics.StackTrace.GetFileColumnNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static Error.IError Create(Error.Level level, string title, string message)
{
System.Diagnostics.StackFrame frame = new System.Diagnostics.StackTrace().GetFrame(2);
System.Reflection.MethodBase method = frame.GetMethod();
Type type = method.DeclaringType;
System.Reflection.AssemblyName assembly = type.Assembly.GetName();
return new Entry() {
Time = DateTime.Now,
Level = level,
Title = title,
Message = message,
AssemblyName = assembly.Name,
AssemblyVersion = assembly.Version.ToString(),
Type = type.FullName,
Method = method.Name,
Filename = frame.GetFileName(),
Line = frame.GetFileLineNumber(),
Column = frame.GetFileColumnNumber(),
};
}
示例2: addSpec
private void addSpec(string name, Action operation, bool enabled, SpecType specType)
{
if (name == String.Empty)
{
throw new Exception("Please specify a name for the spec");
}
var index = 2;
var stackFrame = new System.Diagnostics.StackTrace(true).GetFrame(index);
var codeBase = stackFrame.GetFileName();
var lineNumber = stackFrame.GetFileLineNumber();
var columnNumber = stackFrame.GetFileColumnNumber();
var fileName = Path.GetFileName(codeBase);
var className = this.GetType().FullName;
//var className = this.GetType().Name;
var spec = Registry.SpecFactory(name, operation, Registry.CurrentSuite, codeBase, lineNumber, columnNumber,
fileName, className);
spec.Enabled = enabled && spec.Parent.Enabled;
Registry.CurrentSuite.AddChild(spec);
}