当前位置: 首页>>代码示例>>C#>>正文


C# System.Diagnostics.Where方法代码示例

本文整理汇总了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();
    }
开发者ID:wiltaylor,项目名称:LD33,代码行数:24,代码来源:BuildAll.cs

示例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);
			}
		}
开发者ID:cstick,项目名称:MassTransit,代码行数:60,代码来源:ServiceBusPerformanceCounters.cs

示例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);
			}
		}
开发者ID:jimitndiaye,项目名称:MassTransit,代码行数:53,代码来源:ServiceBusPerformanceCounters.cs


注:本文中的System.Diagnostics.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。