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


C# IReadOnlyCollection.Skip方法代码示例

本文整理汇总了C#中IReadOnlyCollection.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyCollection.Skip方法的具体用法?C# IReadOnlyCollection.Skip怎么用?C# IReadOnlyCollection.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IReadOnlyCollection的用法示例。


在下文中一共展示了IReadOnlyCollection.Skip方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSitemapDocuments

        /// <summary>
        /// Gets the collection of XML sitemap documents for the current site. If there are less than 25,000 sitemap 
        /// nodes, only one sitemap document will exist in the collection, otherwise a sitemap index document will be 
        /// the first entry in the collection and all other entries will be sitemap XML documents.
        /// </summary>
        /// <param name="sitemapNodes">The sitemap nodes for the current site.</param>
        /// <returns>A collection of XML sitemap documents.</returns>
        protected virtual List<string> GetSitemapDocuments(IReadOnlyCollection<SitemapNode> sitemapNodes)
        {
            int sitemapCount = (int)Math.Ceiling(sitemapNodes.Count / (double)MaximumSitemapNodeCount);
            this.CheckSitemapCount(sitemapCount);
            var sitemaps = Enumerable
                .Range(0, sitemapCount)
                .Select(x => 
                    {
                        return new KeyValuePair<int, IEnumerable<SitemapNode>>(
                            x + 1,
                            sitemapNodes.Skip(x * MaximumSitemapNodeCount).Take(MaximumSitemapNodeCount));
                    });

            List<string> sitemapDocuments = new List<string>(sitemapCount);

            if (sitemapCount > 1)
            {
                string xml = this.GetSitemapIndexDocument(sitemaps);
                sitemapDocuments.Add(xml);
            }

            foreach (KeyValuePair<int, IEnumerable<SitemapNode>> sitemap in sitemaps)
            {
                string xml = this.GetSitemapDocument(sitemap.Value);
                sitemapDocuments.Add(xml);
            }

            return sitemapDocuments;
        }
开发者ID:MarcusPozzan,项目名称:ASP.NET-MVC-Boilerplate,代码行数:36,代码来源:SitemapGenerator.cs

示例2: getSizes

 private static IEnumerable<int> getSizes(IReadOnlyCollection<string> args)
 {
     var numberOfFilesystemArguments = args.Contains(recursive) ? 2 : 1;
     var sizes = args.Count == numberOfFilesystemArguments
         ? defaultSizes
         : args.Skip(numberOfFilesystemArguments).Select(a => Convert.ToInt32(a));
     return sizes;
 }
开发者ID:stevedesmond-ca,项目名称:ImageResizer,代码行数:8,代码来源:Program.cs

示例3: ImageGroup

 private ImageGroup(byte[] tableData, IReadOnlyCollection<byte> imageData)
 {
     var table = new ImageTable(tableData);
     var lastIndex = table.Offsets.Length - 1;
     Images = table.Offsets
         .Select((offset, index) => imageData
             .Skip(offset)
             .Take((index == lastIndex ? imageData.Count : table.Offsets[index + 1]) - offset)
             .ToArray())
         .ToArray();
 }
开发者ID:jmfb,项目名称:XComGenerations,代码行数:11,代码来源:ImageGroup.cs

示例4: AlbumPhoto

        private static AlbumPhoto AlbumPhoto(IReadOnlyCollection<Photo> photos, AlbumPhoto previous)
        {
            if (photos.Count == 0)
            {
                return null;
            }

            var head = photos.First();
            var tail = photos.Skip(1).ToList();

            var headPhoto = new AlbumPhoto
            {
                Photo = head,
                Previous = previous
            };

            var tailPhotos = AlbumPhoto(tail, headPhoto);

            headPhoto.Next = tailPhotos;

            return headPhoto;
        }
开发者ID:smgoodman84,项目名称:smgoodman.co.uk,代码行数:22,代码来源:PhotoAlbum.cs

示例5: HandleHelpCommand

		/// <summary>
		/// This function displays available help for all the functionality of this plugin
		/// </summary>
		/// <param name="remoteUserId"></param>
		/// <param name="commandParts"></param>
		private void HandleHelpCommand(ulong remoteUserId, IReadOnlyCollection<string> commandParts)
		{
			if (commandParts.Count == 1)
			{
				List<string> commands = new List<string>();
				foreach (ChatHandlerBase handler in _chatHandlers)
				{
					// We should replace this to just have the handler return a string[] of base commands
					if (handler.GetMultipleCommandText().Length < 1)
					{
						string commandBase = handler.GetCommandText().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).First();
						if (!commands.Contains(commandBase) && (!handler.IsClientOnly()) && (!handler.IsAdminCommand() || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
						{
							commands.Add(commandBase);
						}
					}
					else
					{
						foreach (string cmd in handler.GetMultipleCommandText())
						{
							string commandBase = cmd.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).First();
							if (!commands.Contains(commandBase) && (!handler.IsClientOnly()) && (!handler.IsAdminCommand() || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
							{
								commands.Add(commandBase);
							}
						}
					}
				}

				string commandList = string.Join(", ", commands);
				string info = string.Format("Conquest Plugin v{0}.  Available Commands: {1}", Version, commandList);
				ChatUtil.SendPrivateChat(remoteUserId, info);
			}
			else
			{
				string helpTarget = string.Join(" ", commandParts.Skip(1).ToArray());
				bool found = false;
				foreach (ChatHandlerBase handler in _chatHandlers)
				{
					// Again, we should get handler to just return string[] of command Text
					if (handler.GetMultipleCommandText().Length < 1)
					{
						if (String.Equals(handler.GetCommandText(), helpTarget, StringComparison.CurrentCultureIgnoreCase))
						{
							ChatUtil.SendPrivateChat(remoteUserId, handler.GetHelp());
							found = true;
						}
					}
					else
					{
						foreach (string cmd in handler.GetMultipleCommandText())
						{
							if (String.Equals(cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase))
							{
								ChatUtil.SendPrivateChat(remoteUserId, handler.GetHelp());
								found = true;
							}
						}
					}
				}

				if (!found)
				{
					List<string> helpTopics = new List<string>();

					foreach (ChatHandlerBase handler in _chatHandlers)
					{
						// Again, cleanup to one function
						string[] multipleCommandText = handler.GetMultipleCommandText();
						if (multipleCommandText.Length == 0)
						{
							if (handler.GetCommandText().ToLower().StartsWith(helpTarget.ToLower()) && ((!handler.IsAdminCommand()) || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
							{
								helpTopics.Add(handler.GetCommandText().ToLower().Replace(helpTarget.ToLower(), string.Empty));
							}
						}
						else
						{
							foreach (string cmd in multipleCommandText)
							{
								if (cmd.ToLower().StartsWith(helpTarget.ToLower()) && ((!handler.IsAdminCommand()) || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
								{
									helpTopics.Add(cmd.ToLower().Replace(helpTarget.ToLower(), string.Empty));
								}
							}
						}
					}

					if (helpTopics.Any())
					{
						ChatUtil.SendPrivateChat(remoteUserId, string.Format("Help topics for command '{0}': {1}", helpTarget.ToLower(), string.Join(",", helpTopics.ToArray())));
						found = true;
					}
				}

//.........这里部分代码省略.........
开发者ID:rexxar-tc,项目名称:ConquestPlugin,代码行数:101,代码来源:Conquest.cs

示例6: HandleHelpDialog

        /// <summary>
        /// This function displays available help for all the functionality of this plugin in a dialog window
        /// </summary>
        /// <param name="remoteUserId"></param>
        /// <param name="commandParts"></param>
        private void HandleHelpDialog(ulong remoteUserId, IReadOnlyCollection<string> commandParts)
        {
            if (commandParts.Count == 2)
            {
                List<string> commands = new List<string>();
                foreach (ChatHandlerBase handler in _chatHandlers)
                {
                    // We should replace this to just have the handler return a string[] of base commands
                    if (handler.GetMultipleCommandText().Length < 1)
                    {
                        string commandBase = handler.GetCommandText().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).First();
                        if (!commands.Contains(commandBase) && (!handler.IsClientOnly()) && (!handler.IsAdminCommand() || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
                        {
                            commands.Add(commandBase);
                        }
                    }
                    else
                    {
                        foreach (string cmd in handler.GetMultipleCommandText())
                        {
                            string commandBase = cmd.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).First();
                            if (!commands.Contains(commandBase) && (!handler.IsClientOnly()) && (!handler.IsAdminCommand() || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
                            {
                                commands.Add(commandBase);
                            }
                        }
                    }
                }

                string commandList = string.Join(", ", commands);
                commandList = commandList.Replace(", ", "|");
                //take our list of commands, put line breaks between all the entries and stuff it into a dialog winow

                Communication.DisplayDialog(remoteUserId, "Help", "Available commands",  (commandList + "{0}||Type '/help dialog <command>' for more info."), "close");
            }
            else
            {
                string helpTarget = string.Join(" ", commandParts.Skip(2).ToArray());
                bool found = false;
                foreach (ChatHandlerBase handler in _chatHandlers)
                {
                    // Again, we should get handler to just return string[] of command Text
                    if (handler.GetMultipleCommandText().Length < 1)
                    {
                        if (String.Equals(handler.GetCommandText(), helpTarget, StringComparison.CurrentCultureIgnoreCase))
                        {
                            Communication.DisplayDialog(remoteUserId, handler.GetHelpDialog());
                            found = true;
                        }
                    }
                    else
                    {
                        foreach (string cmd in handler.GetMultipleCommandText())
                        {
                            if (String.Equals(cmd, helpTarget, StringComparison.CurrentCultureIgnoreCase))
                            {
                                Communication.DisplayDialog(remoteUserId, handler.GetHelpDialog());
                                found = true;
                            }
                        }
                    }
                }

                if (!found)
                {
                    List<string> helpTopics = new List<string>();

                    foreach (ChatHandlerBase handler in _chatHandlers)
                    {
                        // Again, cleanup to one function
                        string[] multipleCommandText = handler.GetMultipleCommandText();
                        if (multipleCommandText.Length == 0)
                        {
                            if (handler.GetCommandText().ToLower().StartsWith(helpTarget.ToLower()) && ((!handler.IsAdminCommand()) || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
                            {
                                helpTopics.Add(handler.GetCommandText().ToLower().Replace(helpTarget.ToLower(), string.Empty));
                            }
                        }
                        else
                        {
                            foreach (string cmd in multipleCommandText)
                            {
                                if (cmd.ToLower().StartsWith(helpTarget.ToLower()) && ((!handler.IsAdminCommand()) || (handler.IsAdminCommand() && (PlayerManager.Instance.IsUserAdmin(remoteUserId) || remoteUserId == 0))))
                                {
                                    helpTopics.Add(cmd.ToLower().Replace(helpTarget.ToLower(), string.Empty));
                                }
                            }
                        }
                    }

                    if (helpTopics.Any())
                    {
                        Communication.DisplayDialog(remoteUserId, "Help", helpTarget.ToLower(), string.Format("Help topics for command '{0}': {1}", helpTarget.ToLower(), string.Join(",", helpTopics.ToArray())));
                        found = true;
                    }
//.........这里部分代码省略.........
开发者ID:rexxar-tc,项目名称:EssentialsPlugin,代码行数:101,代码来源:Essentials.cs

示例7: GenerateNext

		private static Func<IMessage, Task<object>> GenerateNext(
			BusSettings busSettings,
			IDependencyScope dependencyScope,
			IReadOnlyCollection<Type> pipelineHandlerTypes,
			IEnumerable<Type> leftHandlerTypes
			)
		{
			return (async message => {

				if (message == null) {
					throw new NullMessageTypeException();
				}

				if (!pipelineHandlerTypes.Any()) {
					return await RunLeafHandlers(busSettings, dependencyScope, leftHandlerTypes, message);
				}

				var head = pipelineHandlerTypes.First();
				var nextHandler = (IPipelineHandler)dependencyScope.GetService(head);

				var tail = pipelineHandlerTypes.Skip(1).ToList();
				var nextFunction = GenerateNext(busSettings, dependencyScope, tail, leftHandlerTypes);

				return await nextHandler.Handle(nextFunction, message);
			});
		}
开发者ID:Sandboxed-Forks,项目名称:Enexure.MicroBus,代码行数:26,代码来源:PipelineBuilder.cs

示例8: GetDoubleConditionFormatLsit

        /// <summary>
        /// 重複した条件付き書式を抽出しリスト化する
        /// </summary>
        /// <param name="conditionFormatLsit">条件付き書式の定義一覧</param>
        /// <returns>削除対象の定義一覧</returns>
        private static IEnumerable<string> GetDoubleConditionFormatLsit(
            IReadOnlyCollection<ConditionFormat> conditionFormatLsit)
        {
            var combinations = conditionFormatLsit.SelectMany(
                (x, i) => conditionFormatLsit.Skip(i + 1).Select(y => new List<ConditionFormat> {x, y}));

            return
                combinations.Where(x => x[0].Sqref == x[1].Sqref && x[0].RuleList == x[1].RuleList)
                    .Select(x => x[1].FullText)
                    .Distinct()
                    .ToList();
        }
开发者ID:yamatoya,项目名称:ExcelCleaner,代码行数:17,代码来源:Program.cs


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