本文整理汇总了C#中System.Diagnostics.Where方法的典型用法代码示例。如果您正苦于以下问题:C# System.Diagnostics.Where方法的具体用法?C# System.Diagnostics.Where怎么用?C# System.Diagnostics.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics
的用法示例。
在下文中一共展示了System.Diagnostics.Where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFolders
public static void CreateFolders()
{
var projectFolder = Application.dataPath + "/../";
var folders = new[]
{
projectFolder + "NonUnityAssets", projectFolder + "Release", projectFolder + "Documents",
Application.dataPath + "/Scripts", Application.dataPath + "/Scenes", Application.dataPath + "/Prefabs",
Application.dataPath + "/Animation", Application.dataPath + "/Sounds", Application.dataPath + "/Sprites",
Application.dataPath + "/Models", Application.dataPath + "/Materials", Application.dataPath + "/Data"
};
foreach (var f in folders.Where(f => !Directory.Exists(f)))
Directory.CreateDirectory(f);
if (File.Exists(projectFolder + ".gitignore")) return;
var gitfile = (from a in AssetDatabase.GetAllAssetPaths()
where a.EndsWith(".gitignore")
select a).First();
File.Copy(gitfile, projectFolder + ".gitignore");
AssetDatabase.Refresh();
}
示例2: InitiatizeCategory
void InitiatizeCategory()
{
try
{
var counters = new[]
{
ConsumerThreadCount,
ReceiveThreadCount,
ReceiveRate,
PublishRate,
SendRate,
ReceiveCount,
PublishCount,
SentCount,
ConsumerDuration,
ConsumerDurationBase,
ReceiveDuration,
ReceiveDurationBase,
PublishDuration,
PublishDurationBase,
};
if (!PerformanceCounterCategory.Exists(CategoryName))
{
PerformanceCounterCategory.Create(
CategoryName,
CategoryHelp,
PerformanceCounterCategoryType.MultiInstance,
new CounterCreationDataCollection(counters.Select(x => (CounterCreationData) x).ToArray()));
return;
}
int missing = counters
.Where(counter => !PerformanceCounterCategory.CounterExists(counter.Name, CategoryName))
.Count();
if (missing > 0)
{
PerformanceCounterCategory.Delete(CategoryName);
PerformanceCounterCategory.Create(
CategoryName,
CategoryHelp,
PerformanceCounterCategoryType.MultiInstance,
new CounterCreationDataCollection(counters.Select(x => (CounterCreationData) x).ToArray()));
}
}
catch (SecurityException)
{
//swallow the exception because having these is NOT critical
var msg =
"Unable to create performance counter category (Category: {0})" +
"\nTry running the program in the Administrator role to set these up." +
"\n**Hey, this just means you aren't admin or don't have/want perf counter support**"
.FormatWith(CategoryName);
_log.Warn(msg);
}
}
示例3: InitiatizeCategory
void InitiatizeCategory()
{
try
{
var counters = new[]
{
ConsumerThreadCount,
ReceiveThreadCount,
ReceiveRate,
PublishRate,
SendRate,
ReceiveCount,
PublishCount,
SentCount,
ConsumerDuration,
ConsumerDurationBase,
ReceiveDuration,
ReceiveDurationBase,
PublishDuration,
PublishDurationBase,
};
if (!PerformanceCounterCategory.Exists(CategoryName))
{
PerformanceCounterCategory.Create(
CategoryName,
CategoryHelp,
PerformanceCounterCategoryType.MultiInstance,
new CounterCreationDataCollection(counters.Select(x => (CounterCreationData) x).ToArray()));
return;
}
int missing = counters
.Where(counter => !PerformanceCounterCategory.CounterExists(counter.Name, CategoryName))
.Count();
if (missing > 0)
{
PerformanceCounterCategory.Delete(CategoryName);
PerformanceCounterCategory.Create(
CategoryName,
CategoryHelp,
PerformanceCounterCategoryType.MultiInstance,
new CounterCreationDataCollection(counters.Select(x => (CounterCreationData) x).ToArray()));
}
}
catch (SecurityException ex)
{
_log.Error("Unable to create performance counter category (Category: {0})\nTry running the program in the Administrator role to set these up.".FormatWith(CategoryName), ex);
}
}