本文整理汇总了C#中System.Diagnostics.StackTrace.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# StackTrace.AsQueryable方法的具体用法?C# StackTrace.AsQueryable怎么用?C# StackTrace.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.StackTrace
的用法示例。
在下文中一共展示了StackTrace.AsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dispose
public void Dispose()
{
if (!_isWriterLock)
{
ReleaseReaderLock();
return;
}
#region Logging the action
string methodInfo = string.Empty;
if (RuntimeInformation.IsUnittest)
{
var stackTrace = new StackTrace();
StackFrame stackFrame =
(from sf in stackTrace.AsQueryable()
where sf.GetMethod().DeclaringType.Assembly.FullName.Contains("Composite.Test")
select sf).FirstOrDefault();
if (stackFrame != null)
{
methodInfo = ", Method: " + stackFrame.GetMethod().Name;
}
}
Log.LogVerbose(LogTitle, "Writer Lock Releasing (Managed Thread ID: {0}, Source: {1}{2})".FormatWith(Thread.CurrentThread.ManagedThreadId, _lockSource, methodInfo));
#endregion
ReleaseWriterLock();
}
示例2: LockerToken
internal LockerToken(bool writerLock, string lockSource)
{
_isWriterLock = writerLock;
_lockSource = lockSource;
if (!writerLock)
{
AcquireReaderLock();
return;
}
Verify.ArgumentCondition(!lockSource.IsNullOrEmpty(), "lockSource", "Write locks must be obtained with a string identifying the source");
#region Logging the action
string methodInfo = string.Empty;
if (RuntimeInformation.IsUnittest)
{
var stackTrace = new StackTrace();
StackFrame stackFrame =
(from sf in stackTrace.AsQueryable()
where sf.GetMethod().DeclaringType.Assembly.FullName.Contains("Composite.Test")
select sf).FirstOrDefault();
if (stackFrame != null)
{
methodInfo = ", Method:" + stackFrame.GetMethod().Name;
}
}
Log.LogVerbose(LogTitle, "Writer Lock Acquired (Managed Thread ID: {0}, Source: {1}{2})".FormatWith(Thread.CurrentThread.ManagedThreadId, lockSource, methodInfo));
#endregion Logging the action
AcquireWriterLock();
}