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


C# IReadOnlyDictionary.Where方法代码示例

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


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

示例1: CreateTableIfNotExists

        internal static string CreateTableIfNotExists(string tableName, CreateFlags createFlags, IReadOnlyDictionary<string, ColumnMapping> columns)
        {
            bool fts3 = (createFlags & CreateFlags.FullTextSearch3) != 0;
            bool fts4 = (createFlags & CreateFlags.FullTextSearch4) != 0;
            bool fts = fts3 || fts4;

            var @virtual = fts ? "VIRTUAL " : string.Empty;
            var @using = fts3 ? "USING FTS3 " : fts4 ? "USING FTS4 " : string.Empty;

            // Build query.
            var query = "CREATE " + @virtual + "TABLE IF NOT EXISTS \"" + tableName + "\" " + @using + "(\n";
            var decls = columns.Select(c => SQLBuilder.SqlDecl(c.Key, c.Value));
            var decl = string.Join(",\n", decls.ToArray());
            query += decl;
            var fkconstraints = 
                string.Join(
                    ",\n", 
                    columns.Where(x => x.Value.ForeignKeyConstraint != null).Select(x =>
                        string.Format("FOREIGN KEY(\"{0}\") REFERENCES \"{1}\"(\"{2}\")",
                             x.Key, 
                             x.Value.ForeignKeyConstraint.TableName,
                             x.Value.ForeignKeyConstraint.ColumnName)));
            query += (fkconstraints.Length != 0) ? "," + fkconstraints : "";
            query += ")";

            return query;
        }
开发者ID:matrostik,项目名称:SQLitePCL.pretty,代码行数:27,代码来源:SQLBuilder.cs

示例2: EventHandlerRegistry

        /// <summary>
        /// Initializes a new instance of <see cref="EventHandlerRegistry"/> with the specified <paramref name="typeLocator"/> and <paramref name="serviceProvider"/>.
        /// </summary>
        /// <param name="sagaStore">The saga store to pass on to any <see cref="SagaEventHandler"/> instances.</param>
        /// <param name="typeLocator">The type locator used to retrieve all known <see cref="Event"/> types.</param>
        /// <param name="serviceProvider">The service locator used to retrieve singleton event handler dependencies.</param>
        /// <param name="commandPublisher">The command publisher used to publish saga commands.</param>
        public EventHandlerRegistry(ILocateTypes typeLocator, IServiceProvider serviceProvider, IStoreSagas sagaStore, Lazy<IPublishCommands> commandPublisher)
        {
            Verify.NotNull(sagaStore, nameof(sagaStore));
            Verify.NotNull(typeLocator, nameof(typeLocator));
            Verify.NotNull(serviceProvider, nameof(serviceProvider));
            Verify.NotNull(commandPublisher, nameof(commandPublisher));

            knownEventHandlers = DiscoverEventHandlers(typeLocator, serviceProvider, sagaStore, commandPublisher);
            knownSagaTimeoutHandlers = knownEventHandlers.Where(item => typeof(Timeout).IsAssignableFrom(item.Key))
                                                         .SelectMany(item => item.Value)
                                                         .OfType<SagaEventHandler>()
                                                         .Distinct(item => item.HandlerType)
                                                         .ToDictionary(item => item.HandlerType, item => new EventHandler[] { item });
        }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:21,代码来源:EventHandlerRegistry.cs

示例3: CompileRule

        public static ProxyRule[] CompileRule(IReadOnlyDictionary<int, ProxyRule> rules)
        {
            if (rules == null) return new ProxyRule[] { Default };
            if (rules.Count == 0) return new ProxyRule[] { Default };

            var result = rules
                .Where(x => x.Value.Enabled && x.Value.Matcher.IsValid)
                .OrderBy(x => x.Key)
                .Select(x => new KeyValuePair<int, ProxyRule>(x.Key, (ProxyRule)x.Value.MemberwiseClone()))
                .Concat(EnumerableEx.Return(new KeyValuePair<int, ProxyRule>(int.MaxValue, Default))).ToArray();
            
            result.Where(x => x.Value.Action == MatchAction.Goto || x.Value.Action == MatchAction.GotoName).ForEach(x => CompileJumpTarget(result, x.Value));

            return result.Select(x => x.Value).ToArray();
        }
开发者ID:c933103,项目名称:KanColleViewer,代码行数:15,代码来源:ProxyRule.cs

示例4: CreateMapCellViewModelsFromEnemiesData

 private static IEnumerable<EnemyCellViewModel> CreateMapCellViewModelsFromEnemiesData(
     MapInfo mi,
     IReadOnlyDictionary<MapInfo, Dictionary<MapCell, Dictionary<string, FleetData>>> mapEnemies,
     IReadOnlyDictionary<MapCell, CellType> cellTypes)
 {
     return mapEnemies.Where(info => info.Key.Id == mi.Id)
         .Select(info => info.Value)
         .SelectMany(cells => cells)
         .Select(cell => new EnemyCellViewModel
         {
             Key = cell.Key.IdInEachMapInfo,
             EnemyFleets = cell.Value
                 .Select(enemy => new EnemyFleetViewModel
                 {
                     Key = enemy.Key,
                     Fleet = enemy.Value,
                     EnemyShips = enemy.Value.Ships.Select(s => new EnemyShipViewModel { Ship = s }).ToArray(),
                 })
                 .GroupBy(x => x.Key, EnemyData.Curret.GetComparer())
                 .Select(x => x.First())
                 .OrderBy(enemy => enemy.Key)
                 .ToArray(),
             ColorNo = cell.Key.ColorNo,
             CellType = cell.Key.GetCellType(cellTypes),
         });
 }
开发者ID:formula28,项目名称:BattleInfoPlugin,代码行数:26,代码来源:EnemyWindowViewModel.cs

示例5: AddOwnedFolderItemsAsync

 public async Task<IReadOnlyDictionary<string, IEnumerable<KeyValuePair<string, string>>>> AddOwnedFolderItemsAsync(IReadOnlyDictionary<string, IEnumerable<KeyValuePair<string, string>>> items) {
     var unhandledItems = await _temporaryItems.AddTemporaryDirectories(_configuredProject, items.Keys);
     return items.Where(i => unhandledItems.Contains(i.Key)).ToImmutableDictionary();
 }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:4,代码来源:FileSystemMirroringProjectSourceItemProviderExtensionBase.cs

示例6: CreateMapCellViewModelsFromEnemiesData

 private static IEnumerable<EnemyCellViewModel> CreateMapCellViewModelsFromEnemiesData(
     MapInfo mi,
     IReadOnlyDictionary<MapInfo, Dictionary<MapCell, Dictionary<string, FleetData>>> mapEnemies,
     IReadOnlyDictionary<MapCell, CellType> cellTypes)
 {
     return mapEnemies.Where(info => info.Key.Id == mi.Id)
         .Select(info => info.Value)
         .SelectMany(cells => cells)
         .Select(cell => new EnemyCellViewModel
         {
             Key = cell.Key.IdInEachMapInfo,
             EnemyFleets = cell.Value.MergeEnemies(),
             ColorNo = cell.Key.ColorNo,
             CellType = cell.Key.GetCellType(cellTypes),
         });
 }
开发者ID:Yoctillion,项目名称:BattleInfoPlugin,代码行数:16,代码来源:EnemyWindowViewModel.cs

示例7: RefreshPlaceholders

        /// <summary>
        /// プレースホルダの表示を更新する
        /// </summary>
        /// <param name="playerName">プレイヤー名</param>
        /// <param name="partyMemberNames">パーティメンバーの名前リスト</param>
        /// <param name="jobPlaceholders">ジョブ名プレースホルダのリスト</param>
        private void RefreshPlaceholders(
            string playerName,
            IReadOnlyList<string> partyMemberNames,
            IReadOnlyDictionary<string, string> jobPlaceholders)
        {
            // 一旦クリアする
            this.MeTextBox.Clear();
            this.Member2TextBox.Clear();
            this.Member3TextBox.Clear();
            this.Member4TextBox.Clear();
            this.Member5TextBox.Clear();
            this.Member6TextBox.Clear();
            this.Member7TextBox.Clear();
            this.Member8TextBox.Clear();
            this.PLDTextBox.Clear();
            this.WARTextBox.Clear();
            this.DRKTextBox.Clear();
            this.WHMTextBox.Clear();
            this.SCHTextBox.Clear();
            this.ASTTextBox.Clear();
            this.MNKTextBox.Clear();
            this.DRGTextBox.Clear();
            this.NINTextBox.Clear();
            this.DRGTextBox.Clear();
            this.BRDTextBox.Clear();
            this.MCHTextBox.Clear();
            this.BLMTextBox.Clear();
            this.SMNTextBox.Clear();

            this.MeTextBox.Text = playerName;

            if (partyMemberNames != null)
            {
                this.Member2TextBox.Text = partyMemberNames.Count > 0 ? partyMemberNames[0] : string.Empty;
                this.Member3TextBox.Text = partyMemberNames.Count > 1 ? partyMemberNames[1] : string.Empty;
                this.Member4TextBox.Text = partyMemberNames.Count > 2 ? partyMemberNames[2] : string.Empty;
                this.Member5TextBox.Text = partyMemberNames.Count > 3 ? partyMemberNames[3] : string.Empty;
                this.Member6TextBox.Text = partyMemberNames.Count > 4 ? partyMemberNames[4] : string.Empty;
                this.Member7TextBox.Text = partyMemberNames.Count > 5 ? partyMemberNames[5] : string.Empty;
                this.Member8TextBox.Text = partyMemberNames.Count > 6 ? partyMemberNames[6] : string.Empty;
            }

            if (jobPlaceholders != null)
            {
                this.PLDTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("PLD")).ToArray());
                this.WARTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("WAR")).ToArray());
                this.DRKTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("DRK")).ToArray());

                this.WHMTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("WHM")).ToArray());
                this.SCHTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("SCH")).ToArray());
                this.ASTTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("AST")).ToArray());

                this.MNKTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("MNK")).ToArray());
                this.DRGTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("DRG")).ToArray());
                this.NINTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("NIN")).ToArray());

                this.BRDTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("BRD")).ToArray());
                this.MCHTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("MCH")).ToArray());

                this.BLMTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("BLM")).ToArray());
                this.SMNTextBox.Text = string.Join(
                    Environment.NewLine,
                    jobPlaceholders.Where(x => x.Key.Contains("SMN")).ToArray());
            }

            this.playerName = playerName;
            this.partyMemberNames = partyMemberNames;
            this.jobPlaceholders = jobPlaceholders;
        }
开发者ID:alalwww,项目名称:ACT.SpecialSpellTimer,代码行数:99,代码来源:ConfigPanel.Monitor.cs


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