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


C# ISet.First方法代码示例

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


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

示例1: CountCommonPathElements

        private int CountCommonPathElements(ISet<Document> documents)
        {
            if (documents.Count == 0)
            {
                return 0;
            }

            var commonPathElements = 0;

            for (var index = 0; ; index++)
            {
                var pathPortion = GetPathPortion(documents.First(), index);
                if (pathPortion == null)
                {
                    return commonPathElements;
                }

                foreach (var document in documents)
                {
                    if (GetPathPortion(document, index) != pathPortion)
                    {
                        return commonPathElements;
                    }
                }

                commonPathElements++;
            }
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:28,代码来源:LibraryManager_GoToDefinition.cs

示例2: CreateMultipleDependencies

 public static IDependencies CreateMultipleDependencies(ISet<IBuilder> subtasks)
 {
     if (subtasks.Count == 0)
         return new NoDependencies();
     else if (subtasks.Count == 1)
         return new SubtaskDependency(subtasks.First());
     else
         return new MultipleDependencies(subtasks.Select(subtask => new SubtaskDependency(subtask)));
 }
开发者ID:zvrana,项目名称:bari,代码行数:9,代码来源:MultipleDependenciesHelper.cs

示例3: TermExpression

        public TermExpression(ISet<TermExpression> terms)
        {
            if (terms == null || terms.Count == 0)
                throw new CqlLinqException("Empty lists are not allowed");

            _type = typeof(ISet<>).MakeGenericType(terms.First().Type);
            _terms = terms.ToList().AsReadOnly();
            _termType = CqlExpressionType.Set;
        }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:9,代码来源:TermExpression.cs

示例4: buildRequestString

        private static string buildRequestString(ISet<int> setOfRbls) {
            if (setOfRbls.Count <= 0) {
                throw new ArgumentOutOfRangeException("setOfRbls", setOfRbls.Count, "Leeres Set von Rbls an den Requester übergeben");
            }
            StringBuilder builder = new StringBuilder();
            builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.MonitorRequestBegin);
            builder.Append(_rblAllocator);
            builder.Append(setOfRbls.First());
            IEnumerable rblEnumerable = setOfRbls.Skip(1);

            foreach (int rbl in rblEnumerable) {
                builder.Append(_rblConnector);
                builder.Append(rbl);
            }
            builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.MonitorRequestEnd);
            builder.Append(ViennaTrafficMonitor.Properties.Settings.Default.SenderIdProd);
            return builder.ToString();
        }
开发者ID:CodefoundryDE,项目名称:ViennaTrafficMonitor,代码行数:18,代码来源:Requester.cs

示例5: CreateSuite

        public Suite CreateSuite(ISet<Goal> goals)
        {
            if (goals.Count == 0)
            {
                goals.Add(Suite.DebugGoal);
                goals.Add(Suite.ReleaseGoal);
            }

            var activeGoal =
                goals.FirstOrDefault(g => g.Name.Equals(targetGoal, StringComparison.InvariantCultureIgnoreCase));

            if (activeGoal == null)
            {
                if (ignoreTargetGoal)
                    activeGoal = goals.First();
                else
                    throw new InvalidGoalException(targetGoal, goals);
            }

            return new Suite(suiteRoot, goals, activeGoal);
        }
开发者ID:zvrana,项目名称:bari,代码行数:21,代码来源:DefaultSuiteFactory.cs

示例6: AllPossibleValues

        private List<string> AllPossibleValues(List<string> dimensions, IDataStructureObject kf, ISet<ICodelistObject> codelists)
        {
            if (NewLines.ContainsKey(string.Join("+", dimensions)))
                return NewLines[string.Join("+", dimensions)];
            Dictionary<string, string> allVals = new Dictionary<string, string>();
            List<string> BuilderSeries = new List<string>();

            foreach (var dim in dimensions)
            {
                if (dim == kf.TimeDimension.Id)
                    return new List<string>();
                IComponent component = kf.Components.FirstOrDefault(c => c.Id == dim);
                if (component == null || !component.HasCodedRepresentation() || string.IsNullOrEmpty(component.Representation.Representation.MaintainableReference.MaintainableId))
                    return new List<string>();
                ICodelistObject codelist = codelists.First(c => c.Id == component.Representation.Representation.MaintainableReference.MaintainableId);
                if (codelist == null)
                    continue;

                List<string> InternalBuilderSeries = new List<string>();

                if (BuilderSeries.Count == 0)
                {
                    foreach (var code in codelist.Items)
                        InternalBuilderSeries.Add(code.Id);
                }
                else
                {
                    BuilderSeries.ForEach(bs =>
                     {
                         foreach (var code in codelist.Items)
                             InternalBuilderSeries.Add(bs + "+" + code.Id);
                     });
                }
                BuilderSeries = InternalBuilderSeries;
            }

            NewLines.Add(string.Join("+", dimensions), BuilderSeries);
            return BuilderSeries;
        }
开发者ID:alcardac,项目名称:SDMX_DATA_BROWSER,代码行数:39,代码来源:DataPaging.cs

示例7: ReconcileGenericTheories

        private IAstTypeReference ReconcileGenericTheories(ISet<IAstTypeReference> theories, IAstMethodReference method)
        {
            if (theories.Count > 1)
                throw new NotImplementedException(string.Format("OverloadResolver: Generic theory aggregation is not yet supported. Method: {0}, theories: {1}.", method, string.Join(", ", theories)));

            return theories.First();
        }
开发者ID:ashmind,项目名称:light,代码行数:7,代码来源:MethodCallResolver.cs

示例8: ReconcileGenericTheories

        private Type ReconcileGenericTheories(ISet<Type> theories)
        {
            if (theories.Count > 1)
                throw new NotImplementedException("OverloadResolver: Generic theory aggregation is not yet supported (theories:" + string.Join(", ", theories) + ")");

            return theories.First();
        }
开发者ID:izobr,项目名称:light,代码行数:7,代码来源:OverloadResolver.cs

示例9: RemovePossibles

 internal SudokuProgress RemovePossibles(IEnumerable<int> existingNumbers)
 {
     if (_blocked)
         return SudokuProgress.NO_PROGRESS;
     // Takes the current possible values and removes the ones existing in `existingNumbers`
     possibleValues = new HashSet<int>(possibleValues.Where(x => !existingNumbers.Contains(x)));
     SudokuProgress result = SudokuProgress.NO_PROGRESS;
     if (possibleValues.Count == 1)
     {
         Fix(possibleValues.First(), "Only one possibility");
         result = SudokuProgress.PROGRESS;
     }
     if (possibleValues.Count == 0)
         return SudokuProgress.FAILED;
     return result;
 }
开发者ID:Zomis,项目名称:SudokuSharp,代码行数:16,代码来源:SudokuTile.cs

示例10: CommonPrefix

        private int CommonPrefix(ISet<string> paths)
        {
            if (paths.Count <= 1)
            {
                return 0;
            }

            var first = paths.First().Split('/');
            var last = paths.Last().Split('/');

            int i = 0;

            while (first[i] == last[i] && i <= first.Length)
            {
                i++;
            }

            // +1 to account for the '/'.
            var result = String.Join("/", first.Take(i));
            return String.IsNullOrEmpty(result) ? 0 : result.Length + 1;
        }
开发者ID:TheCloudlessSky,项目名称:Ignite,代码行数:21,代码来源:TemplateAsset.cs


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