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


C# IEnumerable.IsEmpty方法代码示例

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


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

示例1: ArgumentNotEmpty

 public static void ArgumentNotEmpty(IEnumerable source, [InvokerParameterName] String name, String message)
 {
     if (source.IsEmpty())
     {
         throw new ArgumentException(message, name);
     }
 }
开发者ID:JasonMing,项目名称:Nextension,代码行数:7,代码来源:Ensure.cs

示例2: Convert

        public IDbCommandResult Convert(IEnumerable values)
        {
            if (values.IsEmpty())
            {
                return new QueryResult();
            }
            var type = values.GetTypeOfValues();

            if (type.IsValueType || type == typeof(string))
            {
                return QueryResultOfValues(values, type);
            }
            if (type == typeof(DynamicRecord))
            {
                return QueryResultOfDynamicRecord(values.Cast<DynamicRecord>());
            }
            if (type == typeof(DynamicDataRow))
            {
                return QueryResultOfDynamicDataRow(values.Cast<DynamicDataRow>());
            }
            if (type.IsAssignableFrom(typeof(IDictionary)))
            {
                return QueryResultOfDictionary((IEnumerable<IDictionary>)values);
            }

            return QueryResultOfType(values, type);
        }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:27,代码来源:CollectionConverter.cs

示例3: AlignTokensOperation

        internal AlignTokensOperation(SyntaxToken baseToken, IEnumerable<SyntaxToken> tokens, AlignTokensOption option)
        {
            Contract.ThrowIfNull(tokens);
            Debug.Assert(!tokens.IsEmpty());

            this.Option = option;
            this.BaseToken = baseToken;
            this.Tokens = tokens;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:AlignTokensOperation.cs

示例4: TextChangeEventArgs

        /// <summary>
        /// Initializes an instance of <see cref="TextChangeEventArgs"/>.
        /// </summary>
        /// <param name="oldText">The text before the change.</param>
        /// <param name="newText">The text after the change.</param>
        /// <param name="changes">A non-empty set of ranges for the change.</param>
        public TextChangeEventArgs(SourceText oldText, SourceText newText, IEnumerable<TextChangeRange> changes)
        {
            if (changes == null || changes.IsEmpty())
            {
                throw new ArgumentException("changes");
            }

            this.OldText = oldText;
            this.NewText = newText;
            this.Changes = changes.ToImmutableArray();
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:17,代码来源:TextChangeEventArgs.cs

示例5: ExecuteMultipartQuery

        public string ExecuteMultipartQuery(ITwitterQuery twitterQuery, string contentId, IEnumerable<IMedia> medias)
        {
            if (medias == null || medias.IsEmpty())
            {
                return ExecuteQuery(twitterQuery);
            }

            var webRequest = _twitterRequestGenerator.GenerateMultipartWebRequest(twitterQuery, contentId, medias);
            var result = _webRequestExecutor.ExecuteMultipartRequest(webRequest);

            return result;
        }
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:12,代码来源:TwitterRequester.cs

示例6: AddDependencies

        public static void AddDependencies(this IFigure figure, IEnumerable<IFigure> dependencies)
        {
            if (figure == null || dependencies.IsEmpty())
            {
                return;
            }

            foreach (var dependency in dependencies)
            {
                dependency.Dependents.Add(figure);
            }
        }
开发者ID:ondrej11,项目名称:o106,代码行数:12,代码来源:IFigureExtensions.cs

示例7: Build

        public static Directory Build(IEnumerable<WeaveHistoryItem> weaveHistoryItems)
        {
            if (weaveHistoryItems.IsEmpty())
            {
                return new Directory("All History", "history");
            }
            else
            {
                // Today
                var todayQuery = from b in weaveHistoryItems
                                 let dateTime = b.Visits!= null ? b.Visits.First().Date : DateTime.MinValue
                                 where IsToday(dateTime)
                                 orderby dateTime
                                 select b;

                Directory today = new Directory("Today", "today");
                foreach (WeaveHistoryItem historyItem in todayQuery)
                    today.Bookmarks.Add(new Bookmark(historyItem.Title, historyItem.Uri));

                // Yesterday
                var yesterdayQuery = from b in weaveHistoryItems
                                     let dateTime = b.Visits != null ? b.Visits.First().Date : DateTime.MinValue
                                     where IsYesterday(dateTime)
                                     orderby dateTime
                                     select b;

                Directory yesterday = new Directory("Yesterday", "yesterday");
                foreach (WeaveHistoryItem historyItem in yesterdayQuery)
                    yesterday.Bookmarks.Add(new Bookmark(historyItem.Title, historyItem.Uri));

                // This Month
                var thisMonthQuery = from b in weaveHistoryItems
                                     let dateTime = b.Visits != null ? b.Visits.First().Date : DateTime.MinValue
                                     where IsThisMonth(dateTime)
                                     orderby dateTime
                                     select b;

                Directory thisMonth = new Directory("This Month", "thismonth");
                foreach (WeaveHistoryItem historyItem in thisMonthQuery)
                    thisMonth.Bookmarks.Add(new Bookmark(historyItem.Title, historyItem.Uri));

                // History
                Directory history = new Directory("All History", "history");
                history.Directories.Add(today);
                history.Directories.Add(yesterday);
                history.Directories.Add(thisMonth);

                return history;
            }
        }
开发者ID:pieterderycke,项目名称:CloudFox,代码行数:50,代码来源:HistoryStructureBuilder.cs

示例8: Join

        public IEnumerable<CorrelatedResult> Join(IEnumerable<RunResult> sourceResults,
                                                  IEnumerable<RunResult> targetResults)
        {
            var sourceArray = (sourceResults ?? Enumerable.Empty<RunResult>()).ToArray();
            var targetArray = (targetResults ?? Enumerable.Empty<RunResult>()).ToArray();

            if (targetArray.IsEmpty())
                return Enumerable.Empty<CorrelatedResult>();

            if (sourceResults.IsEmpty())
                return targetArray.Select(x => new CorrelatedResult(new NullResult(), x));

            return joinTwoNonEmptyCollections(sourceArray, targetArray);
        }
开发者ID:erichexter,项目名称:TestSwarm,代码行数:14,代码来源:IResultsJoiner.cs

示例9: StrategyReport

		/// <summary>
		/// Initialize <see cref="StrategyReport"/>.
		/// </summary>
		/// <param name="strategies">Strategies, requiring the report generation.</param>
		/// <param name="fileName">The name of the file, in which the report is generated.</param>
		protected StrategyReport(IEnumerable<Strategy> strategies, string fileName)
		{
			if (strategies == null)
				throw new ArgumentNullException(nameof(strategies));

			if (strategies.IsEmpty())
				throw new ArgumentOutOfRangeException(nameof(strategies));

			if (fileName.IsEmpty())
				throw new ArgumentNullException(nameof(fileName));

			Strategies = strategies;
			FileName = fileName;
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:19,代码来源:StrategyReport.cs

示例10: NewRow

        public static LayoutElement NewRow(IEnumerable<LayoutElement> nodes, 
            LayoutElementType type = LayoutElementType.Row)
        {
            RectangleF dummyBounds = new RectangleF(0,0,1,1);
            var e = new LayoutElement(type, dummyBounds, null, nodes);

            // set bounds
            if (!nodes.IsEmpty())
            {
                e.Text = nodes.Select(x => x.Text).Where(x => !String.IsNullOrEmpty(x)).ElementsToStringS(delim: " ");
                e.SetBoundsFromNodes(false);
            }

            return e;
        }
开发者ID:jazzlife,项目名称:pdf-ebook-reader,代码行数:15,代码来源:LayoutElement.cs

示例11: LoadItemsFromConfig

 private IEnumerable<IScopeContext> LoadItemsFromConfig(Type type, IEnumerable<IScopeContext> items)
 {
     items = ConfigurationResolver.GetTypeBindingsFromConfig(type);
     if (items.IsEmpty())
     {
         Optimizer.AddBaseTypeIfNonExisting(type);
     }
     else
     {
         foreach (var scopeContext in items)
         {
             Optimizer.SetImplementationType(type, scopeContext, scopeContext.ImplementationKey);
         }
     }
     return items;
 }
开发者ID:JonasSyrstad,项目名称:Stardust,代码行数:16,代码来源:TypeResolverKernel.cs

示例12: QueryResultOfDynamicDataRow

        private IDbCommandResult QueryResultOfDynamicDataRow(IEnumerable<DynamicDataRow> values)
        {
            var result = new QueryResult();
            if (values.IsEmpty())
            {
                return result;
            }

            var columns = values.First().Columns;
            columns.Each(c => result.AddColumn(c, typeof(string)));
            foreach (var record in values)
            {
                var theRecord = record;
                result.AddRow(columns.Select(c => theRecord[c]));
            }
            return result;
        }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:17,代码来源:CollectionConverter.cs

示例13: ExtractTagRank

        private IDictionary<string, double> ExtractTagRank(string text, IEnumerable<string> allowPos)
        {
            if (allowPos.IsEmpty())
            {
                allowPos = DefaultPosFilter;
            }

            var g = new UndirectWeightedGraph();
            var cm = new Dictionary<string, int>();
            var words = PosSegmenter.Cut(text).ToList();

            for (var i = 0; i < words.Count(); i++)
            {
                var wp = words[i];
                if (PairFilter(wp))
                {
                    for (var j = i + 1; j < i + Span; j++)
                    {
                        if (j >= words.Count)
                        {
                            break;
                        }
                        if (!PairFilter(words[j]))
                        {
                            continue;
                        }

                        // TODO: better separator.
                        var key = wp.Word + "$" + words[j].Word;
                        if (!cm.ContainsKey(key))
                        {
                            cm[key] = 0;
                        }
                        cm[key] += 1;
                    }
                }
            }

            foreach (var p in cm)
            {
                var terms = p.Key.Split('$');
                g.AddEdge(terms[0], terms[1], p.Value);
            }

            return g.Rank();
        }
开发者ID:riiiqpl,项目名称:jieba.NET,代码行数:46,代码来源:TextRankExtractor.cs

示例14: InsertMethods

        private static void InsertMethods(HtmlElement parent, string name, IEnumerable<MethodInfo> methods)
        {
            // Setup initial conditions.
            if (methods.IsEmpty()) return;

            // Create the method container.
            var methodContainer = CreateElement(name);
            parent.AppendChild(methodContainer);

            // Insert each method.
            foreach (var methodInfo in methods)
            {
                var htmMethod = CreateElement("method");
                htmMethod.SetAttribute("name", methodInfo.Name);
                htmMethod.SetAttribute("class", methodInfo.DeclaringType.FullName);
                methodContainer.AppendChild(htmMethod);
            }
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:18,代码来源:TestRunHtmlOutputWriter.cs

示例15: Remove

        /// <summary>
        /// 删除文件资源。
        /// </summary>
        /// <param name="filePaths">文件路径</param>
        public static void Remove(IEnumerable<string> filePaths)
        {
            if (filePaths.IsEmpty())
            {
                return;
            }

            foreach (var file in filePaths)
            {
                var fileInfo = new FileInfo(HttpContext.Current.Server.MapPath(file));

                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                    RemoveCompressionImage(fileInfo.FullName);
                }
            }
        }
开发者ID:fenglinz,项目名称:Sparrow,代码行数:22,代码来源:FileManager.cs


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