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


C# IEnumerable.ToImmutableList方法代码示例

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


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

示例1: Exercise

        public Exercise(ILoggerService loggerService, ISpeechService speechService, string name, int setCount, int repetitionCount, IEnumerable<MatcherWithAction> matchersWithActions)
        {
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));
            name.AssertNotNull(nameof(name));
            matchersWithActions.AssertNotNull(nameof(matchersWithActions));

            if (setCount < 0)
            {
                throw new ArgumentException("setCount cannot be less than zero.", "setCount");
            }

            if (repetitionCount < 0)
            {
                throw new ArgumentException("repetitionCount cannot be less than zero.", "repetitionCount");
            }

            this.logger = loggerService.GetLogger(this.GetType());
            this.speechService = speechService;
            this.name = name;
            this.setCount = setCount;
            this.repetitionCount = repetitionCount;
            this.matchersWithActions = matchersWithActions.ToImmutableList();

            using (var dummyExecutionContext = new ExecutionContext())
            {
                this.duration = this
                    .GetEventsWithActions(dummyExecutionContext)
                    .SelectMany(x => x.Actions)
                    .Select(x => x.Duration)
                    .DefaultIfEmpty()
                    .Aggregate((running, next) => running + next);
            }
        }
开发者ID:reactiveui-forks,项目名称:WorkoutWotch,代码行数:34,代码来源:Exercise.cs

示例2: PhotoSet

 public PhotoSet(string id, PhotoSetType type, string displayName, IEnumerable<Photo> photos)
 {
     this.Id = id;
     this.Type = type;
     this.DisplayName = displayName;
     this.Photos = photos.ToImmutableList();
 }
开发者ID:PhotoArchive,项目名称:core,代码行数:7,代码来源:PhotoSet.cs

示例3: XRefCollection

 public XRefCollection(IEnumerable<Uri> uris)
 {
     if (uris == null)
     {
         throw new ArgumentNullException(nameof(uris));
     }
     Uris = uris.ToImmutableList();
 }
开发者ID:dotnet,项目名称:docfx,代码行数:8,代码来源:XRefCollection.cs

示例4: FSharpCompilationFailure

 public FSharpCompilationFailure(
   string filePath,
   IEnumerable<FSharpCompilationMessage> messages)
 {
   _filePath = filePath;
   _fileContent = File.Exists(filePath) ? File.ReadAllText(filePath) : null;
   _messages = messages.ToImmutableList();
 }
开发者ID:SabotageAndi,项目名称:YoloDev.Dnx.FSharp,代码行数:8,代码来源:FSharpCompilationFailure.cs

示例5: ValuesEntity

 public ValuesEntity(string id, DateTimeOffset createdOn, DateTimeOffset lastModifiedOn, DateTimeOffset lastAccessedOn, IEnumerable<string> values = null)
 {
     this.Id = id;
     this.CreatedOn = createdOn;
     this.LastModifiedOn = lastModifiedOn;
     this.LastAccessedOn = lastAccessedOn;
     this.Values = values == null ? ImmutableList<string>.Empty : values.ToImmutableList();
 }
开发者ID:xinyanmsft,项目名称:SFStartupHttp,代码行数:8,代码来源:ValuesEntity.cs

示例6: Configuration

 public Configuration(
     IEnumerable<Transformation> namespaceTransformations,
     IEnumerable<Transformation> nameTransformations,
     IEnumerable<Filter> interfaceFilters)
 {
     this.namespaceTransformations = namespaceTransformations.ToImmutableList();
     this.nameTransformations = nameTransformations.ToImmutableList();
     this.interfaceFilters = interfaceFilters.ToImmutableList();
 }
开发者ID:modulexcite,项目名称:PCLMock,代码行数:9,代码来源:Configuration.cs

示例7: SearchMethodInfo

 public SearchMethodInfo(SearchTypeInfo type, string methodName, IEnumerable<string> parameters = null,
     IEnumerable<string> typeParameters = null, bool? isStatic = null, bool? isAbstract = null)
 {
     Type = type;
     MethodName = methodName;
     Parameters = parameters?.ToImmutableList();
     TypeParameters = typeParameters == null ? ImmutableList<string>.Empty : (typeParameters.ToImmutableList());
     IsStatic = isStatic;
     IsAbstract = isAbstract;
 }
开发者ID:vbfox,项目名称:NFluentConversion,代码行数:10,代码来源:SearchMethodInfo.cs

示例8: MetronomeAction

        public MetronomeAction(IAudioService audioService, IDelayService delayService, ILoggerService loggerService, IEnumerable<MetronomeTick> ticks)
        {
            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            ticks.AssertNotNull(nameof(ticks));

            this.ticks = ticks.ToImmutableList();
            this.innerAction = new SequenceAction(GetInnerActions(audioService, delayService, loggerService, this.ticks));
        }
开发者ID:reactiveui-forks,项目名称:WorkoutWotch,代码行数:10,代码来源:MetronomeAction.cs

示例9: ParallelAction

        public ParallelAction(IEnumerable<IAction> children)
        {
            Ensure.ArgumentNotNull(children, nameof(children), assertContentsNotNull: true);

            this.children = children.ToImmutableList();
            this.duration = this
                .children
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Max();
        }
开发者ID:gregjones60,项目名称:WorkoutWotch,代码行数:11,代码来源:ParallelAction.cs

示例10: SequenceAction

        public SequenceAction(IEnumerable<IAction> children)
        {
            children.AssertNotNull(nameof(children), assertContentsNotNull: true);

            this.children = children.ToImmutableList();
            this.duration = this
                .children
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Aggregate((running, next) => running + next);
        }
开发者ID:reactiveui-forks,项目名称:WorkoutWotch,代码行数:11,代码来源:SequenceAction.cs

示例11: 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.ToImmutableList();
        }
开发者ID:riversky,项目名称:roslyn,代码行数:17,代码来源:TextChangeEventArgs.cs

示例12: ClassificationResult

		public ClassificationResult(
				IEnumerable<SuspiciousNode> suspiciousNodes, IEnumerable<BigInteger> wronglyAcceptedFeatures,
				IEnumerable<BigInteger> wronglyRejectedFeatures, int wrongVectorCount, int wrongElementCount,
				EncodingResult encodingResult) {
			SuspiciousNodes = suspiciousNodes != null ? suspiciousNodes.ToImmutableList() : null;
			WronglyAcceptedVectors = wronglyAcceptedFeatures.ToImmutableList();
			WronglyRejectedVectors = wronglyRejectedFeatures.ToImmutableList();
			WrongVectorCount = wrongVectorCount;
			WrongElementCount = wrongElementCount;
			_vector2Node = encodingResult.Vector2Node;
		}
开发者ID:RainsSoft,项目名称:Code2Xml,代码行数:11,代码来源:ClassificationResult.cs

示例13: ExerciseProgram

        public ExerciseProgram(ILoggerService loggerService, string name, IEnumerable<Exercise> exercises)
        {
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(name, nameof(name));
            Ensure.ArgumentNotNull(exercises, nameof(exercises), assertContentsNotNull: true);

            this.logger = loggerService.GetLogger(this.GetType());
            this.name = name;
            this.exercises = exercises.ToImmutableList();
            this.duration = this
                .exercises
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Aggregate((running, next) => running + next);
        }
开发者ID:gregjones60,项目名称:WorkoutWotch,代码行数:15,代码来源:ExerciseProgram.cs

示例14: RuleReference

        public RuleReference(Implication originalRule, IEnumerable<PropNetFlattener.Condition> conditions, IList<Term> productionTemplate = null)
        {
            OriginalRule = originalRule;
            ProductionTemplate = productionTemplate==null ? ImmutableList<Term>.Empty :  productionTemplate.ToImmutableList();

            Conditions = conditions.ToImmutableList();

            int producttionTemplateHashCode = 1;

            if (productionTemplate != null)
                foreach (Term term in productionTemplate)
                    producttionTemplateHashCode = 31 * producttionTemplateHashCode + (term == null ? 0 : term.GetHashCode());

            int conditionsHashcode = Conditions.Aggregate(1, (current, cond) => 31 * current + (cond == null ? 0 : cond.GetHashCode()));
            _hashCode = producttionTemplateHashCode + conditionsHashcode;
        }
开发者ID:druzil,项目名称:nggp-base,代码行数:16,代码来源:RuleReference.cs

示例15: Step

        private Step(Step step, IEnumerable<Cell> cells, IEnumerable<Cell> rotateCells, Cell newCenter)
        {
            height = step.height;
            width = step.width;
            pieceIndex = step.pieceIndex;
            commandIndex = step.commandIndex + 1;
            points = step.points;

            Center = newCenter;
            Pieces = step.Pieces;
            CurrentPieceCells = rotateCells.ToImmutableList();
            UsedCells = step.UsedCells;
            RunningCells = cells.ToImmutableHashSet();
        }
开发者ID:dantre,项目名称:Sunday,代码行数:14,代码来源:Antropov_Dmitry.cs


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