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


C# ISet.Select方法代码示例

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


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

示例1: Preprocess

 public ISet<string> Preprocess(ISet<string> tags)
 {
     var resultTags = new SortedSet<string>();
     foreach (var tag in tags.Select(t => SkipPattern.Replace(t, "")))
         resultTags.UnionWith(tag.Split(SplitChars, StringSplitOptions.RemoveEmptyEntries));
     return resultTags;
 }
开发者ID:CrowdKnowledge,项目名称:codetag,代码行数:7,代码来源:SpecialCharsTagPreprocessor.cs

示例2: ComputeArtistsHash

 public static string ComputeArtistsHash(ISet<Artist> artists)
 {
     const int sizeOfId = sizeof(int);
     var ids = artists.Select(a => a.Id).OrderBy(id => id).ToArray();
     byte[] byteArray = new byte[ids.Count() * sizeOfId];
     Buffer.BlockCopy(ids, 0, byteArray, 0, ids.Count() * sizeOfId);
     MD5 md5 = new MD5CryptoServiceProvider();
     return Util.Extensions.GetMd5Hash(md5, byteArray);
 }
开发者ID:gclark916,项目名称:Howler,代码行数:9,代码来源:Album.cs

示例3: 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

示例4: GetNumberOfPlays

        /// <summary>
        /// Gets the number of times the specified videos have been played.
        /// </summary>
        public async Task<IEnumerable<PlayStats>> GetNumberOfPlays(ISet<Guid> videoIds)
        {
            // Enforce some sanity on this until we can change the data model to avoid the multi-get
            if (videoIds.Count > 20) throw new ArgumentOutOfRangeException("videoIds", "Cannot do multi-get on more than 20 video id keys.");

            var prepared = await _statementCache.NoContext.GetOrAddAsync("SELECT videoid, views FROM video_playback_stats WHERE videoid = ?"); ;

            // Run queries in parallel (another example of multi-get at the driver level)
            var idsAndTasks = videoIds.Select(id => new { VideoId = id, ExecuteTask = _session.ExecuteAsync(prepared.Bind(id)) }).ToArray();
            await Task.WhenAll(idsAndTasks.Select(idAndResult => idAndResult.ExecuteTask)).ConfigureAwait(false);

            // Be sure to return stats for each video id (even if the row was null)
            return idsAndTasks.Select(idTask => MapRowToPlayStats(idTask.ExecuteTask.Result.SingleOrDefault(), idTask.VideoId));
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:17,代码来源:StatisticsService.cs

示例5: RequestAssetsAsync

            public override async Task<IList<ValueTuple<Checksum, object>>> RequestAssetsAsync(int sessionId, ISet<Checksum> checksums, CancellationToken callerCancellationToken)
            {
                // it should succeed as long as matching VS is alive
                // TODO: add logging mechanism using Logger

                // this can be called in two ways. 
                // 1. Connection to get asset is closed (the asset source we were using is disconnected - _assetChannelCancellationToken)
                //    if this asset source's channel is closed, service will move to next asset source to get the asset as long as callerCancellationToken
                //    is not cancelled
                //
                // 2. Request to required this asset has cancelled. (callerCancellationToken)
                using (var mergedCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(_owner.CancellationToken, callerCancellationToken))
                using (RoslynLogger.LogBlock(FunctionId.SnapshotService_RequestAssetAsync, GetRequestLogInfo, sessionId, checksums, mergedCancellationToken.Token))
                {
                    return await _owner.Rpc.InvokeAsync(WellKnownServiceHubServices.AssetService_RequestAssetAsync,
                        new object[] { sessionId, checksums.Select(c => c.ToArray()).ToArray() },
                        (s, c) => ReadAssets(s, sessionId, checksums, c), mergedCancellationToken.Token).ConfigureAwait(false);
                }
            }
开发者ID:genlu,项目名称:roslyn,代码行数:19,代码来源:SnapshotService.JsonRpcAssetSource.cs

示例6: CutRedundantSolutionBuilds

        private bool CutRedundantSolutionBuilds(ISet<EquatableEdge<IBuilder>> graph)
        {
            log.Debug("### Cutting redundant solution builds");

            var slnBuilders = new HashSet<SlnBuilder>(graph.Select(edge => edge.Target).OfType<SlnBuilder>());
            var rootBuilderMap = graph
                .Where(edge => edge.Source is MSBuildRunner && slnBuilders.Contains(edge.Target))
                .ToDictionary(edge => (SlnBuilder)edge.Target, edge => FindSolutionRootBuilder(graph, edge));

            if (slnBuilders.Any())
            {
                foreach (var slnBuilder in slnBuilders)
                {
                    if (rootBuilderMap.ContainsKey(slnBuilder))
                    {
                        var projectSet = new HashSet<Project>(slnBuilder.Projects);
                        var childProjectBuilders = new HashSet<ISlnProjectBuilder>(slnBuilder
                            .Prerequisites
                            .OfType<ISlnProjectBuilder>());

                        foreach (var projectBuilder in childProjectBuilders)
                        {
                            foreach (var dep in projectBuilder.Prerequisites.OfType<SuiteReferenceBuilder>().ToList())
                            {
                                if (dep.Reference.Type == ReferenceType.Build &&
                                    projectSet.Contains(dep.ReferencedProject))
                                {
                                    log.DebugFormat(
                                        "Project {0}'s reference {1} can be replaced to in-solution-reference in {2}",
                                        projectBuilder.Project, dep, slnBuilder);

                                    // All sln project builders belonging to `slnBuilder` must replace their reference to dep to a
                                    // new in solution reference builder (both in the builder and in the graph)
                                    ReplaceWithInSolutionReference(graph, childProjectBuilders, dep);

                                    // All edges from dep must be removed and a single new edge to the MSBuild runner belonging to this `slnBuilder` added
                                    RemoveEdgesWhereSourceIs(graph, dep);

                                    var newEdge = new EquatableEdge<IBuilder>(dep, rootBuilderMap[slnBuilder]);
                                    AddEdge(graph, newEdge);
                                }
                            }
                        }
                    }
                }
            }

            return true;
        }
开发者ID:vigoo,项目名称:bari,代码行数:49,代码来源:OptimizingBuildContextFactory.cs

示例7: RemoveSubdirectories

 private IList<ChangePoolEntry> RemoveSubdirectories(ISet<ChangePoolEntry> dirList)
 {
     IList<ChangePoolEntry> result = new List<ChangePoolEntry>();
     foreach (ChangePoolEntry entry in dirList)
     {
         string dir = entry.PathChanged;
         if (dirList.Select(d => d.PathChanged).Where(d => d != dir).All(d => !FileSystemOperationsService.IsSubdirectory(d, dir)))
         {
             result.Add(entry);
         }
     }
     return result;
 }
开发者ID:kmerlin,项目名称:PsISEProjectExplorer,代码行数:13,代码来源:FileSystemChangeNotifier.cs

示例8: GetVideoPreviews

        /// <summary>
        /// Gets a limited number of video preview data by video id.
        /// </summary>
        public async Task<IEnumerable<VideoPreview>> GetVideoPreviews(ISet<Guid> videoIds)
        {
            if (videoIds == null || videoIds.Count == 0) return Enumerable.Empty<VideoPreview>();

            // Since we're doing a multi-get here, limit the number of previews to 20 to try and enforce some
            // performance sanity.  If we ever needed to do more than that, we might think about a different
            // data model that doesn't involve a multi-get.
            if (videoIds.Count > 20) throw new ArgumentOutOfRangeException("videoIds", "videoIds cannot contain more than 20 video id keys.");

            // As an example, let's do the multi-get using multiple statements at the driver level.  For an example of doing this at
            // the CQL level with an IN() clause, see UserReadModel.GetUserProfiles
            PreparedStatement prepared = await _statementCache.NoContext.GetOrAddAsync(
                "SELECT videoid, userid, added_date, name, preview_image_location FROM videos WHERE videoid = ?");

            // Bind multiple times to the prepared statement with each video id and execute all the gets in parallel, then await
            // the completion of all the gets
            RowSet[] rowSets = await Task.WhenAll(videoIds.Select(id => _session.ExecuteAsync(prepared.Bind(id)))).ConfigureAwait(false);

            // Flatten the rows in the rowsets to VideoPreview objects
            return rowSets.SelectMany(rowSet => rowSet, (_, row) => MapRowToVideoPreview(row));
        }
开发者ID:johnbabb,项目名称:killrvideo-csharp,代码行数:24,代码来源:VideoCatalogService.cs

示例9: Preprocess

 public ISet<string> Preprocess(ISet<string> tags)
 {
     return new SortedSet<string>(tags.Select(t => t.ToLower()));
 }
开发者ID:petercerno,项目名称:codetag,代码行数:4,代码来源:LowerCaseTagPreprocessor.cs


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