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


C# IReadOnlyDictionary.Select方法代码示例

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


在下文中一共展示了IReadOnlyDictionary.Select方法的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: GetPkiTool

 public IPkiTool GetPkiTool(IReadOnlyDictionary<string, object> initParams)
 {
     var kvPairs = initParams.Select(_ =>
             new KeyValuePair<string, string>(_.Key, _.Value.ToString()));
     var newParams = kvPairs.ToDictionary(
             _ => _.Key,
             _ => _.Value);
     return new BCPkiTool(newParams);
 }
开发者ID:ebekker,项目名称:ACMESharp,代码行数:9,代码来源:BCPkiToolProvider.cs

示例3: GetSwitchMappings

 static public Dictionary<string,string> GetSwitchMappings(
     IReadOnlyDictionary<string, string> configurationStrings)
 {
     return configurationStrings.Select(item =>
         new KeyValuePair<string, string>(
             "-" + item.Key.Substring(item.Key.LastIndexOf(':')+1),
             item.Key))
             .ToDictionary(
                 item => item.Key, item=>item.Value);
 }
开发者ID:IntelliTect,项目名称:Articles,代码行数:10,代码来源:Program.cs

示例4: AsRelativeUri

        public static Uri AsRelativeUri(this string @this, PagingOptions paging,
            IEnumerable<AppIdentifier> context = null, IReadOnlyDictionary<string, string> extraParameters = null)
        {
            var parameters = new List<string>();

            if (paging.From.HasValue)
                parameters.Add($"_from={WebUtility.UrlEncode(paging.From.ToString())}");

            if (paging.To.HasValue)
                parameters.Add($"_to={WebUtility.UrlEncode(paging.To.ToString())}");

            if (context != null)
                parameters.Add("context=" + string.Join("/", context));

            if (extraParameters != null)
                parameters.AddRange(extraParameters.Select(
                    p => $"{WebUtility.UrlEncode(p.Key)}={WebUtility.UrlEncode(p.Value)}"));

            return AsRelativeUri(@this, parameters);
        }
开发者ID:vtex,项目名称:apps-client-net,代码行数:20,代码来源:StringExtensions.cs

示例5: Handle

 public IEnumerable<StageResult> Handle(IReadOnlyDictionary<Guid, List<IAggregatableMessage>> processingResultsMap)
 {
     return processingResultsMap.Select(pair => Handle(pair.Key, pair.Value));
 }
开发者ID:gitter-badger,项目名称:nuclear-river,代码行数:4,代码来源:AggregateOperationAggregatableMessageHandler.cs

示例6: Query

        public async Task<IRow[]> Query(IReadOnlyDictionary<string, string> columns)
        {
            if (null == columns)
            {
                throw new ArgumentNullException(CommaDelimitedFileAdapter.ArgumentNameColumns);
            }

            string query = 
                string.Format(
                    CultureInfo.InvariantCulture,
                    CommaDelimitedFileAdapter.QueryTemplate,
                    this.fileName);
            if (columns.Any())
            {
                IReadOnlyCollection<string> filters =
                    columns
                    .Select(
                        (KeyValuePair<string, string> item) =>
                            string.Format(
                                CultureInfo.InvariantCulture,
                                CommaDelimitedFileAdapter.FilterTemplate,
                                item.Key,
                                item.Value))
                    .ToArray();
                string filter =
                    string.Join(CommaDelimitedFileAdapter.DelimiterFilter, filters);

                query = string.Concat(query, CommaDelimitedFileAdapter.WhereClausePrefix, filter);
            }

            OleDbCommand commandQuery = null;
            try
            {
                commandQuery = new OleDbCommand(query, connection);
                DbDataReader reader = null;
                try
                {
                    reader = await commandQuery.ExecuteReaderAsync();
                    IList<IRow> rows = new List<IRow>();

                    while (reader.Read())
                    {
                        string rowKey = (string)reader[0];
                        Dictionary<string, string> rowColumns = 
                            new Dictionary<string, string>(this.headers.Count - 1);
                        for (int indexColumn = 1; indexColumn < this.headers.Count; indexColumn++)
                        {
                            string columnValue = reader[indexColumn] as string;
                            if (string.IsNullOrWhiteSpace(columnValue))
                            {
                                continue;
                            }

                            string columnHeader = this.headers.ElementAt(indexColumn);

                            rowColumns.Add(columnHeader, columnValue);
                        }

                        IRow row = new Row(rowKey, rowColumns);
                        rows.Add(row);
                    }

                    IRow[] results = rows.ToArray();
                    return results;
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                        reader = null;
                    }
                }
            }
            finally
            {
                if (commandQuery != null)
                {
                    commandQuery.Dispose();
                    commandQuery = null;
                }
            }
        }
开发者ID:sunilkrpv,项目名称:AzureTestProvisioning,代码行数:83,代码来源:CommaDelimitedFileAdapter.cs

示例7: GetReplacedDefinitions

        public static IReadOnlyCollection<ReplacementInfo> GetReplacedDefinitions(IReadOnlyDictionary<string, ITypeSymbol> sutSubstitutions, ISymbol typeSymbol)
        {
            var replacements = sutSubstitutions.Select(kv => new[]
            {
                new {Original = "<" + kv.Key + ">", Replacement = "<" + GetSimpleTypeName(kv.Value) + ">"},
                new {Original = "<" + kv.Key + ",", Replacement = "<" + GetSimpleTypeName(kv.Value) + ","},
                new {Original = ", " + kv.Key + ",", Replacement = ", " + GetSimpleTypeName(kv.Value) + ","},
                new {Original = ", " + kv.Key + ">", Replacement = ", " + GetSimpleTypeName(kv.Value) + ">"}
            });

            var originalType = GetSimpleTypeName(typeSymbol);

            var replacedDefinition = replacements.Select(s => s.Aggregate(originalType, (sum, repl) => sum.Replace(repl.Original, repl.Replacement)))
                                                 .Select(x => new ReplacementInfo { IsReplaced = x != originalType, Result = x})
                                                 .ToArray();

            return replacedDefinition;
        }
开发者ID:ycherkes,项目名称:MockIt,代码行数:18,代码来源:TestSemanticHelper.cs


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