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


C# ReadOnlyCollection.Select方法代码示例

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


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

示例1: BuildHql

		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
		{
			IEnumerable<HqlExpression> args = visitor.Visit(targetObject)
				.Union(arguments.Select(a => visitor.Visit(a)))
				.Cast<HqlExpression>();

			return treeBuilder.MethodCall(_name, args);
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:8,代码来源:StandardLinqExtensionMethodGenerator.cs

示例2: OnBreakpoint

 public void OnBreakpoint(DebuggedThread thread, ReadOnlyCollection<object> clients, uint address)
 {
     // An engine that supports more advanced breakpoint features such as hit counts, conditions and filters
     // should notify each bound breakpoint that it has been hit and evaluate conditions here.
     // The sample engine does not support these features.
     var boundBreakpointsEnum = new AD7BoundBreakpointsEnum(clients.Select(c => (IDebugBoundBreakpoint2)c));
     Send(new AD7BreakpointEvent(boundBreakpointsEnum), thread.Client);
 }
开发者ID:bagobor,项目名称:NodeVsDebugger,代码行数:8,代码来源:EngineCallback.cs

示例3: BuildHql

		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject,
		                                     ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder,
		                                     IHqlExpressionVisitor visitor)
		{
			IEnumerable<HqlExpression> args = arguments.Select(a => visitor.Visit(a))
				.Cast<HqlExpression>();

			return treeBuilder.BooleanMethodCall("FREETEXT", args);
		}
开发者ID:juanplopes,项目名称:nhibernate,代码行数:9,代码来源:BooleanMethodExtensionExample.cs

示例4: EvaluateParameters

        private string EvaluateParameters(ReadOnlyCollection<ParameterExpression> parameters)
        {
            if (parameters.Count == 0)
                return "()";

            if (parameters.Count == 1)
                return parameters[0].Name;

            return string.Format("({0})", string.Join(", ", parameters.Select(pe => pe.Name)));
        }
开发者ID:SergeyTeplyakov,项目名称:VerificationFakes,代码行数:10,代码来源:ExpressionsPrinter.cs

示例5: SetupTargetMatcher

        public SetupTargetMatcher(IMethodImporter methodImporter, ReadOnlyCollection<SetupTarget> targets)
        {
            ArgumentChecker.NotNull(methodImporter, () => methodImporter);
            ArgumentChecker.NotNull(targets, () => targets);

            _targets = targets
                .Select(target => new Tuple<SetupTarget, MethodReference>(
                    target, methodImporter.Import(target.Method)))
                .ToList();
        }
开发者ID:gmf520,项目名称:Smocks,代码行数:10,代码来源:SetupTargetMatcher.cs

示例6: KeyBindingData

        public KeyBindingData(ReadOnlyCollection<CommandKeyBinding> bindings)
        {
            // All bindings passed have the same KeyInput as their first key, so get it
            var firstKeyInput = bindings.First().KeyBinding.FirstKeyStroke;
            KeyName = KeyBinding.CreateKeyBindingStringForSingleKeyStroke(firstKeyInput);

            _bindings = bindings;
            _handledByOptions.AddRange(
                new[] {
                     _visualStudioOption = new KeyBindingHandledByOption("Visual Studio", bindings.Select(binding => binding.Name)),
                     _vsVimOption = new KeyBindingHandledByOption("VsVim", Enumerable.Empty<string>())
                });
        }
开发者ID:niklasi,项目名称:VsVim,代码行数:13,代码来源:KeyBindingData.cs

示例7: LockingCoordinator

        LockingCoordinator(
            IEnumerable<LockingNode> nodes,
            Func<long> timeProvider,
            Func<LockingNode, IRedisClient> redisClientFactory,
            ILogger logger)
        {
            _logger = logger;
            _nodes = new ReadOnlyCollection<LockingNode>(nodes.ToArray());
            _timeProvider = timeProvider;
            _redisClientFactory = redisClientFactory;
            _lockAcquisitionCancellation = new CancellationTokenSource();

            _redisClients = _nodes
                            .Select(_redisClientFactory)
                            .ToList();
        }
开发者ID:barambani,项目名称:varekai,代码行数:16,代码来源:LockingCoordinator.cs

示例8: ResolveTypeName

 public DkmClrType ResolveTypeName(string typeName, ReadOnlyCollection<DkmClrType> typeArguments)
 {
     var type = this.Assembly.GetType(typeName);
     if (type == null)
     {
         Interlocked.Increment(ref _resolveTypeNameFailures);
         throw new ArgumentException();
     }
     Debug.Assert(typeArguments.Count == type.GetGenericArguments().Length);
     if (typeArguments.Count > 0)
     {
         var typeArgs = typeArguments.Select(t => ((TypeImpl)t.GetLmrType()).Type).ToArray();
         type = type.MakeGenericType(typeArgs);
     }
     return _runtimeInstance.GetType((TypeImpl)type);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:16,代码来源:DkmClrModuleInstance.cs

示例9: WatchingResolvePathTemplateManager

 //private readonly Task queueListenerTask;
 /// <summary>
 /// Creates a new WatchingResolvePathTemplateManager.
 /// </summary>
 /// <param name="layoutRoot">the folders to watch and look for templates.</param>
 /// <param name="cache">the cache to invalidate</param>
 public WatchingResolvePathTemplateManager(IEnumerable<string> layoutRoot, InvalidatingCachingProvider cache)
 {
     this.cache = cache;
     var list = new ReadOnlyCollection<string>(new List<string>(layoutRoot));
     inner = new ResolvePathTemplateManager(list);
     watchers = list.Select(path =>
     {
         var watcher = new FileSystemWatcher(Path.GetFullPath(path), "*.*");
         watcher.EnableRaisingEvents = true;
         watcher.IncludeSubdirectories = true;
         watcher.Changed += watcher_Changed;
         watcher.Created += watcher_Changed;
         watcher.Deleted += watcher_Changed;
         watcher.Renamed += watcher_Renamed;
         return watcher;
     }).ToList();
     //queueListenerTask = StartQueue();
 }
开发者ID:RoboBurned,项目名称:RazorEngine,代码行数:24,代码来源:WatchingResolvePathTemplateManager.cs

示例10: KeyBindingData

        public KeyBindingData(ReadOnlyCollection<CommandKeyBinding> bindings)
        {
            // All bindings passed have the same KeyInput as their first key, so get it
            var firstKeyInput = bindings.First().KeyBinding.FirstKeyStroke;
            KeyName = KeyBinding.CreateKeyBindingStringForSingleKeyStroke(firstKeyInput);

            // It's possible that Visual Studio will bind multiple key strokes to the same
            // command.  Often it will be things like "Ctrl-[, P" and "Ctr-[, Ctrl-P".  In
            // that case we don't want to list the command twice so filter that possibility
            // out here
            var commandNames = bindings.Select(x => x.Name).Distinct(StringComparer.OrdinalIgnoreCase);

            _bindings = bindings;
            _handledByOptions.AddRange(
                new[] {
                     _visualStudioOption = new KeyBindingHandledByOption("Visual Studio", commandNames),
                     _vsVimOption = new KeyBindingHandledByOption("VsVim", Enumerable.Empty<string>())
                });
        }
开发者ID:honeyhoneywell,项目名称:VsVim,代码行数:19,代码来源:KeyBindingData.cs

示例11: ShowNewFiles

        public void ShowNewFiles(Version version, string description, ReadOnlyCollection<string> updateFiles, string basePath, UpdateInfo oldUpdate)
        {
            caption.Text = "New version: " + version.ToString();
            descriptionText.Text = description;
            descriptionText.Properties.ReadOnly = false;

            //If there are old files, set everything to Added, then refine later.
            int defaultState = (int)(oldUpdate == null ? FileState.None : FileState.Added);

            var filesData = new List<TreeFile>(
                updateFiles
                    .Select(p => new TreeFile(p, isFolder: false) { State = defaultState })
                    .OrderBy(tf => tf.Name)
            );

            if (oldUpdate != null) {
                foreach (var oldFile in oldUpdate.Files) {
                    var newPath = Path.Combine(basePath, oldFile.RelativePath);

                    var newFile = filesData.FirstOrDefault(f => f.FullPath.Equals(newPath, StringComparison.OrdinalIgnoreCase));
                    if (newFile == null) continue;

                    if (oldFile.Matches(basePath))
                        newFile.State = (int)FileState.Identical;
                    else
                        newFile.State = (int)FileState.Changed;
                }
            }

            //The directories must be added after setting the State properties so I don't set their's too.
            filesData.AddRange(Directory.EnumerateDirectories(basePath, "*.*", SearchOption.AllDirectories).Select(p => new TreeFile(p, isFolder: true)));

            files.RootValue = basePath;
            files.DataSource = filesData;
            files.ExpandAll();
        }
开发者ID:ShomreiTorah,项目名称:Utilities,代码行数:36,代码来源:UpdateDetails.cs

示例12: Init

        // Initializes global state.
        // 'webApiSegmentsTreeMeasuresUri' must specify the Web API URI that returns information about the requestable
        // measures from the Segments Tree Node resource.
        // 'exportCultureNames' must specify the names (e.g. "en-US") of the cultures that can be used when
        // exporting data (e.g. CSV data); can be null/empty.  The culture names must be separated by spaces.
        // Throws an exception and logs an error in the event of error.
        public async static void Init(Uri webApiSegmentsTreeMeasuresUri, String exportCultureNames,
            ILogging logging)
        {
            if (webApiSegmentsTreeMeasuresUri == null)
                throw new ArgumentNullException("webApiSegmentsTreeMeasuresUri");


            // Get information about the Segments Tree Node measures.
            // NOTE: the Segments Tree Node measures (as opposed to the Time Series measures) can grow from time
            // to time (from sprint to sprint), so we pull down the latest list whenever the app starts up.
            String measuresXml = String.Empty;
            HttpClient httpClient = null;
            try
            {
                httpClient = new HttpClient();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
                var response = await httpClient.GetAsync(webApiSegmentsTreeMeasuresUri);
                response.EnsureSuccessStatusCode();
                measuresXml = await response.Content.ReadAsStringAsync();
            }
            catch (Exception ex)
            {
                // Log the error.
                var errorMessage = "Failed to get information about the Segments Tree Node measures from " +
                                   "the Web API.  " + ex.ToString();
                System.Diagnostics.Debug.WriteLine(errorMessage);
                if (logging != null)
                    logging.LogError(errorMessage);

                throw;
            }
            finally
            {
                if (httpClient != null)
                    httpClient.Dispose();
            }


            // Parse the measures info XML, and store the resulting collection in '_segmentsTreeMeasures'.
            try
            {
                var doc = XDocument.Parse(measuresXml);
                XNamespace ns = "http://statpro.com/2012/Revolution";
                _segmentsTreeMeasures = doc.Root
                                           .Element(ns + "measures").Elements(ns + "measure")
                                           .Select(me => new MeasureInfo(me, ns))
                                           .ToList().AsReadOnly();
            }
            catch (Exception ex)
            {
                // Log the error.
                var errorMessage = "Failed to parse the information about the Segments Tree Node measures that " +
                                   "was returned by the Web API.  " + ex.ToString();
                System.Diagnostics.Debug.WriteLine(errorMessage);
                if (logging != null)
                    logging.LogError(errorMessage);

                throw;
            }


            // Derive a separate collection of the named categories into which the Segments Tree Node measures
            // fall.
            _segmentsTreeMeasureCategories = _segmentsTreeMeasures.Select(mi => mi.Category)
                                                                  .Distinct()
                                                                  .OrderBy(c => c)
                                                                  .ToList().AsReadOnly();


            // Set up the collection of export cultures.  Unrecognised culture names are ignored.
            if (String.IsNullOrWhiteSpace(exportCultureNames))
            {
                _exportCultures = new List<CultureInfo>().AsReadOnly();
                return;
            }

            Func<String, CultureInfo> getCultureOrNull = name => 
                { try { return new CultureInfo(name); } catch (CultureNotFoundException) { return null; } };

            _exportCultures = exportCultureNames.Split(' ')
                                                .Select(name => getCultureOrNull(name))
                                                .Where(ci => ci != null)
                                                .OrderBy(ci => ci.DisplayName)
                                                .ToList().AsReadOnly();
        }
开发者ID:Reniro,项目名称:RevolutionWebApiExplorer,代码行数:91,代码来源:GlobalStateAccess.cs

示例13: GetIndexOfConstraintDimension

		private static int GetIndexOfConstraintDimension(IConstraint constraint, ReadOnlyCollection<DimensionWithValues> dimensionValues,
			QualifiedDimension dimension)
		{
			int ret = 0;
			foreach (DimensionWithValues dv in dimensionValues)
			{
				if (IsSubset(dimension, dv.Dimension))
				{
					return ret;
				}
				ret++;
			}
			throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
				"Dimension {0} from constraint {1} was not found in the matrix (all dimensions: {2}).",
				dimension.FullyQualifiedName, constraint.GetType().Name, string.Join(",", dimensionValues.Select(dv => dv.Dimension.FullyQualifiedName))));
		}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:PartialVectorConstraintChecker.cs

示例14: ExpandOuterMatrixDimensionIfNeeded

		private static IEnumerable<QualifiedDimension> ExpandOuterMatrixDimensionIfNeeded(QualifiedDimension toExpand, ReadOnlyCollection<DimensionWithValues> dimensionValues)
		{
			IEnumerable<QualifiedDimension> ret = dimensionValues.Select(dv => dv.Dimension).Where(d => IsSubset(d, toExpand));
			if (toExpand.BaseDimension is Matrix && ret.Any())
			{
				return ret;
			}
			else
			{
				return Enumerable.Repeat(toExpand, 1);
			}
		}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:PartialVectorConstraintChecker.cs

示例15: GetIndexOfDimension

		private static int GetIndexOfDimension(QualifiedDimension targetDimension, ReadOnlyCollection<DimensionWithValues> dimensionValues,
			string origin)
		{
			int ret = 0;
			foreach (DimensionWithValues dv in dimensionValues)
			{
				if (targetDimension.Equals(dv.Dimension))
				{
					return ret;
				}
				ret++;
			}
			throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
				"Dimension {0} from {1} was not found in the explored matrix (all dimensions: {2}).",
				targetDimension.FullyQualifiedName, origin, string.Join(",", dimensionValues.Select(dv => dv.Dimension.FullyQualifiedName))));
		}
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:PairwiseStrategy.cs


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