本文整理汇总了C#中Process.TraceMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Process.TraceMessage方法的具体用法?C# Process.TraceMessage怎么用?C# Process.TraceMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process.TraceMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary> Obtains instance of DebugType. Same types will return identical instance. </summary>
static public DebugType Create(Process process, ICorDebugType corType)
{
DateTime startTime = Util.HighPrecisionTimer.Now;
DebugType type = new DebugType(process, corType);
// Get types with matching names from cache
List<DebugType> typesWithMatchingName;
if (!loadedTypes.TryGetValue(type.FullName, out typesWithMatchingName)) {
// No types with such name - create a new list
typesWithMatchingName = new List<DebugType>(1);
loadedTypes.Add(type.FullName, typesWithMatchingName);
}
// Try to find the type
foreach(DebugType loadedType in typesWithMatchingName) {
if (loadedType.Equals(type)) {
TimeSpan totalTime = Util.HighPrecisionTimer.Now - startTime;
if (process.Options.Verbose) {
process.TraceMessage("Type " + type.FullName + " was loaded already (" + totalTime.TotalMilliseconds + " ms)");
}
return loadedType; // Type was loaded before
}
}
// The type is not in the cache, finish loading it and add it to the cache
if (type.IsClass || type.IsValueType) {
type.LoadMemberInfo();
}
typesWithMatchingName.Add(type);
type.Process.Exited += delegate { typesWithMatchingName.Remove(type); };
TimeSpan totalTime2 = Util.HighPrecisionTimer.Now - startTime;
string prefix = type.IsInterface ? "interface" : "type";
if (process.Options.Verbose) {
process.TraceMessage("Loaded {0} {1} ({2} ms)", prefix, type.FullName, totalTime2.TotalMilliseconds);
foreach(DebugType inter in type.Interfaces) {
process.TraceMessage(" - Implements {0}", inter.FullName);
}
}
return type;
}