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


C# ReadOnlyCollection.OfType方法代码示例

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


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

示例1: GCodeFile

		private GCodeFile(List<Command> toolpath)
		{
			Toolpath = new ReadOnlyCollection<Command>(toolpath);

			Vector3 min = Vector3.MaxValue, max = Vector3.MinValue;

			foreach (Motion m in Enumerable.Concat(Toolpath.OfType<Line>(), Toolpath.OfType<Arc>().SelectMany(a => a.Split(0.1))))
			{
				for (int i = 0; i < 3; i++)
				{
					if (m.End[i] > max[i])
						max[i] = m.End[i];

					if (m.End[i] < min[i])
						min[i] = m.End[i];
				}

				TravelDistance += m.Length;
			}

			Max = max;
			Min = min;

			Vector3 size = Max - Min;

			for (int i = 0; i < 3; i++)
			{
				if (size[i] < 0)
					size[i] = 0;
			}

			Size = size;
		}
开发者ID:martin2250,项目名称:OpenCNCPilot,代码行数:33,代码来源:GCodeFile.cs

示例2: FormatCommenter

        /// <inheritdoc cref="FormatCommenter(ITextBuffer, CommentFormat[])"/>
        public FormatCommenter(ITextBuffer textBuffer, IEnumerable<CommentFormat> commentFormats)
        {
            Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires<ArgumentNullException>(commentFormats != null, "commentFormats");
            Contract.Requires<ArgumentException>(!commentFormats.Contains(null));

            this._textBuffer = textBuffer;
            this._commentFormats = commentFormats.ToList().AsReadOnly();
            this._blockFormats = _commentFormats.OfType<BlockCommentFormat>().ToList().AsReadOnly();
            this._lineFormats = _commentFormats.OfType<LineCommentFormat>().ToList().AsReadOnly();
            this._useLineComments = this._lineFormats.Count > 0;
        }
开发者ID:modulexcite,项目名称:vsbase,代码行数:13,代码来源:FormatCommenter.cs

示例3: Commenter

        public Commenter(ITextView textView, ITextUndoHistoryRegistry textUndoHistoryRegistry, IEnumerable<CommentFormat> commentFormats)
        {
            Contract.Requires<ArgumentNullException>(textView != null, "textView");
            Contract.Requires<ArgumentNullException>(textUndoHistoryRegistry != null, "textUndoHistoryRegistry");
            Contract.Requires<ArgumentNullException>(commentFormats != null, "commentFormats");

            this._textView = textView;
            this._textUndoHistoryRegistry = textUndoHistoryRegistry;
            this._commentFormats = commentFormats.ToList().AsReadOnly();
            this._blockFormats = _commentFormats.OfType<BlockCommentFormat>().ToList().AsReadOnly();
            this._lineFormats = _commentFormats.OfType<LineCommentFormat>().ToList().AsReadOnly();
            this._useLineComments = this._lineFormats.Count > 0;
        }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:13,代码来源:Commenter.cs

示例4: RecycleConfiguration

        /// <summary>
        /// Check service configuration update for changes that we cannot handle without a recycle.
        /// </summary>
        /// <param name="changes">Collection of changes from RoleEnvironmentChanging event.</param>
        /// <returns>True if a non-handled configuration change was made, requiring a role recycle.</returns>
        private bool RecycleConfiguration(ReadOnlyCollection<RoleEnvironmentChange> changes)
        {
            Func<RoleEnvironmentConfigurationSettingChange, bool> changeForcesRecycle =
                    x => !nonRecycleConfigurationItems.Contains(x.ConfigurationSettingName);

            return changes.OfType<RoleEnvironmentConfigurationSettingChange>().Any(changeForcesRecycle);
        }
开发者ID:wpdiary,项目名称:PolyGlotPersistence,代码行数:12,代码来源:WebRole.cs

示例5: GameVM

        public GameVM(IGameBoardVM gameBoardVM, IEnumerable<IToolVM> tools)
        {
            GameBoard = gameBoardVM;

            Tools = new ReadOnlyCollection<IToolVM>(tools.ToList());

            foreach (var toolVM in Tools.OfType<ISelectableToolVM>())
            {
                toolVM.IsSelected += ToolIsSelected;
            }
        }
开发者ID:MadCowDevelopment,项目名称:Sudoku,代码行数:11,代码来源:GameVM.cs

示例6: HasNonExemptConfigurationChanges

        /// <summary>
        /// HasNonExemptConfigurationChanges - Check if config changes contain any that aren't on our "exempt from recycle" list
        /// Returns TRUE if there is at least one config change that isn't on our list.
        /// </summary>
        /// <param name="chgs">Collection of changes from RoleEnvironmentChanging or RoleEnvironmentChanged</param>
        /// <returns></returns>
        private bool HasNonExemptConfigurationChanges(ReadOnlyCollection<RoleEnvironmentChange> chgs)
        {
            Func<RoleEnvironmentConfigurationSettingChange, bool> changeIsNonExempt =
                    x => !ExemptConfigurations.Contains(x.ConfigurationSettingName);

            var environmentChanges = chgs.OfType<RoleEnvironmentConfigurationSettingChange>();

            return environmentChanges.Any(changeIsNonExempt);
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:15,代码来源:DiagnosticsHelper.cs

示例7: AddMergeRedirectionExpressions

 private void AddMergeRedirectionExpressions(
     ReadOnlyCollection<RedirectionAst> redirections,
     List<ParameterExpression> temps,
     List<Expression> exprs,
     List<Expression> finallyExprs)
 {
     foreach (var mergingRedirectionAst in redirections.OfType<MergingRedirectionAst>())
     {
         var savedPipes = NewTemp(typeof(Pipe[]), "savedPipes");
         temps.Add(savedPipes);
         var redirectionExpr = Expression.Constant(VisitMergingRedirection(mergingRedirectionAst));
         exprs.Add(
             Expression.Assign(savedPipes,
                               Expression.Call(redirectionExpr,
                                               CachedReflectionInfo.MergingRedirection_BindForExpression,
                                               _executionContextParameter,
                                               _functionContext)));
         // Undo merging redirections first (so file redirections get undone after).
         finallyExprs.Insert(0, Expression.Call(redirectionExpr.Cast(typeof(CommandRedirection)),
                                                CachedReflectionInfo.CommandRedirection_UnbindForExpression,
                                                _functionContext,
                                                savedPipes));
     }
 }
开发者ID:40a,项目名称:PowerShell,代码行数:24,代码来源:Compiler.cs

示例8: AddMergeRedirectionExpressions

 private void AddMergeRedirectionExpressions(ReadOnlyCollection<RedirectionAst> redirections, List<ParameterExpression> temps, List<Expression> exprs, List<Expression> finallyExprs)
 {
     foreach (MergingRedirectionAst ast in redirections.OfType<MergingRedirectionAst>())
     {
         ParameterExpression item = this.NewTemp(typeof(Pipe[]), "savedPipes");
         temps.Add(item);
         ConstantExpression instance = Expression.Constant(this.VisitMergingRedirection(ast));
         exprs.Add(Expression.Assign(item, Expression.Call(instance, CachedReflectionInfo.MergingRedirection_BindForExpression, _executionContextParameter, _functionContext)));
         finallyExprs.Insert(0, Expression.Call(instance.Cast(typeof(CommandRedirection)), CachedReflectionInfo.CommandRedirection_UnbindForExpression, _functionContext, item));
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:Compiler.cs


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