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


C# IReadOnlyDictionary.ToDictionary方法代码示例

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


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

示例1: SqlSagaStore

        /// <summary>
        /// Initializes a new instance of <see cref="SqlSagaStore"/>.
        /// </summary>
        /// <param name="dialect">The database dialect associated with this <see cref="SqlSagaStore"/>.</param>
        /// <param name="serializer">The <see cref="ISerializeObjects"/> used to store binary data.</param>
        /// <param name="typeLocator">The type locator use to retrieve all known <see cref="Saga"/> types.</param>
        public SqlSagaStore(ISagaStoreDialect dialect, ISerializeObjects serializer, ILocateTypes typeLocator)
        {
            Verify.NotNull(typeLocator, nameof(typeLocator));
            Verify.NotNull(serializer, nameof(serializer));
            Verify.NotNull(dialect, nameof(dialect));

            this.dialect = dialect;
            this.serializer = serializer;
            this.typeToGuidMap = GetKnownSagas(typeLocator);
            this.guidToTypeMap = typeToGuidMap.ToDictionary(item => item.Value, item => item.Key);

            Initialize();
        }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:19,代码来源:SqlSagaStore.cs

示例2: PointData

 public PointData(
     string measurement,
     IReadOnlyDictionary<string, object> fields,
     IReadOnlyDictionary<string, string> tags = null,
     DateTime? utcTimestamp = null)
 {
     if (measurement == null) throw new ArgumentNullException("measurement");
     if (fields == null) throw new ArgumentNullException("fields");
     Measurement = measurement;
     Fields = fields.ToDictionary(kv => kv.Key, kv => kv.Value);
     if (tags != null)
         Tags = tags.ToDictionary(kv => kv.Key, kv => kv.Value);
     UtcTimestamp = utcTimestamp;
 }
开发者ID:robertmilne,项目名称:influxdb-lineprotocol,代码行数:14,代码来源:PointData.cs

示例3: SecurityExchangeHours

        /// <summary>
        /// Initializes a new instance of the <see cref="SecurityExchangeHours"/> class
        /// </summary>
        /// <param name="timeZone">The time zone the dates and hours are represented in</param>
        /// <param name="holidayDates">The dates this exchange is closed for holiday</param>
        /// <param name="marketHoursForEachDayOfWeek">The exchange's schedule for each day of the week</param>
        public SecurityExchangeHours(DateTimeZone timeZone, IEnumerable<DateTime> holidayDates, IReadOnlyDictionary<DayOfWeek, LocalMarketHours> marketHoursForEachDayOfWeek)
        {
            _timeZone = timeZone;
            _holidays = holidayDates.Select(x => x.Date.Ticks).ToHashSet();
            // make a copy of the dictionary for internal use
            _openHoursByDay = new Dictionary<DayOfWeek, LocalMarketHours>(marketHoursForEachDayOfWeek.ToDictionary());

            SetMarketHoursForDay(DayOfWeek.Sunday, out _sunday);
            SetMarketHoursForDay(DayOfWeek.Monday, out _monday);
            SetMarketHoursForDay(DayOfWeek.Tuesday, out _tuesday);
            SetMarketHoursForDay(DayOfWeek.Wednesday, out _wednesday);
            SetMarketHoursForDay(DayOfWeek.Thursday, out _thursday);
            SetMarketHoursForDay(DayOfWeek.Friday, out _friday);
            SetMarketHoursForDay(DayOfWeek.Saturday, out _saturday);
        }
开发者ID:rchien,项目名称:Lean,代码行数:21,代码来源:SecurityExchangeHours.cs

示例4: BenchmarkContext

 public BenchmarkContext(IReadOnlyDictionary<CounterMetricName, Counter> counters, IBenchmarkTrace trace)
 {
     Trace = trace;
     _counters = counters.ToDictionary(k => k.Key.CounterName, v => v.Value);
 }
开发者ID:petabridge,项目名称:NBench,代码行数:5,代码来源:BenchmarkContext.cs

示例5: AddChildCommand

 public AddChildCommand(OperatorDefinition definition,
                        IReadOnlyDictionary<string, PropertyTreeMetaObject> arguments)
 {
     this.definition = definition;
     this.arguments = arguments.ToDictionary(t => t.Key, t => t.Value.Component);
 }
开发者ID:Carbonfrost,项目名称:ff-property-trees,代码行数:6,代码来源:AddChildCommand.cs

示例6: SymbolPropertiesDatabase

 private SymbolPropertiesDatabase(IReadOnlyDictionary<SecurityDatabaseKey, SymbolProperties> entries)
 {
     _entries = entries.ToDictionary();
 }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:4,代码来源:SymbolPropertiesDatabase.cs

示例7: DummyPackagesConfigNuGetProject

 public DummyPackagesConfigNuGetProject(IReadOnlyDictionary<string, object> metadata) : base(Directory.GetCurrentDirectory(), metadata.ToDictionary(x => x.Key, x => x.Value))
 {
 }
开发者ID:mjheitland,项目名称:TableTweaker,代码行数:3,代码来源:NuGetViewModel.cs

示例8: InsertRow

        private async Task<IRow> InsertRow(string key, IReadOnlyDictionary<string, string> columns)
        {
            logger.Info("inserting row to file: " + columns.ToString());

            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(CommaDelimitedFileAdapter.ArgumentNameRow);
            }

            if (null == columns)
            {
                throw new ArgumentNullException(CommaDelimitedFileAdapter.ArgumentNameColumns);
            }

            IDictionary<string, string> valuesByNormalizedNames =
                columns
                .ToDictionary(
                    (KeyValuePair<string, string> item) =>
                        new Value(item.Key).ToString().ToUpperInvariant(),
                    (KeyValuePair<string, string> item) =>
                        item.Value);

            IList<string> values = new List<string>(this.headers.Count);

            string keyNormalized = new Value(key).ToString();
            values.Add(keyNormalized);

            IEnumerable<string> normalizedHeaders = this.headersNormalized.Skip(1);
            foreach (string normalizedHeader in normalizedHeaders)
            {
                string value = null;
                if (!valuesByNormalizedNames.TryGetValue(normalizedHeader, out value))
                {
                    values.Add(string.Empty);
                    continue;
                }

                string normalizedValue = new Value(value).ToString();
                values.Add(normalizedValue);
            }

            string row =
                string.Join(CommaDelimitedFileAdapter.Comma, values);

            AsyncSemaphore.Releaser? releaser = null;
            try
            {
                releaser = await this.semaphore.EnterAsync();

                StreamWriter writer = null;
                try
                {
                    writer = File.AppendText(this.FilePath);
                    logger.Info("inserting row: " + row);
                    await writer.WriteLineAsync(row);
                }
                finally
                {
                    if (writer != null)
                    {
                        writer.Close();
                        writer = null;
                    }
                }
            }
            finally
            {
                if (releaser.HasValue)
                {
                    releaser.Value.Dispose();
                    releaser = null;
                }
            }

            IRow result = new Row(keyNormalized, columns);
            return result;
        }
开发者ID:sunilkrpv,项目名称:AzureTestProvisioning,代码行数:77,代码来源:CommaDelimitedFileAdapter.cs

示例9: CommandlineParameters

 public CommandlineParameters(IReadOnlyDictionary<string, string> dictionary)
 {
     _dictionary = dictionary.ToDictionary(x => x.Key.ToLower(), x => x.Value.ToLower());
 }
开发者ID:2gis,项目名称:nuclear-data-test,代码行数:4,代码来源:CommandlineParameters.cs

示例10: MessageFilterComponent

        static MessageFilterComponent()
        {
            _criteriaPropertyNames = new Dictionary<CriteriaPropertyType, string>()
            {
                { CriteriaPropertyType.From, "from" },
                { CriteriaPropertyType.To, "to" },
                { CriteriaPropertyType.Subject, "subject" },
                { CriteriaPropertyType.HasTheWords, "hasTheWord" },
                { CriteriaPropertyType.DoesntHave, "doesNotHaveTheWord" },
                { CriteriaPropertyType.HasAttachment, "hasAttachment" },
                { CriteriaPropertyType.ExcludeChats, "excludeChats" },
                { CriteriaPropertyType.Size, "size" },
                { CriteriaPropertyType.SizeOperator, "sizeOperator" },
                { CriteriaPropertyType.SizeUnit, "sizeUnit" }
               }.AsReadOnly();
            _criteriaPropertyTypes = _criteriaPropertyNames.ToDictionary(o => o.Value, o => o.Key).AsReadOnly();

            _actionPropertyNames = new Dictionary<ActionPropertyType, string>()
            {
                { ActionPropertyType.ArchiveIt, "shouldArchive" },
                { ActionPropertyType.MarkAsRead, "shouldMarkAsRead" },
                { ActionPropertyType.StarIt, "shouldStar" },
                { ActionPropertyType.ApplyLabel, "label" },
                { ActionPropertyType.ForwardIt, "forwardTo" },
                { ActionPropertyType.DeleteIt, "shouldTrash" },
                { ActionPropertyType.NeverSendToSpam, "shouldNeverSpam" },
                { ActionPropertyType.AlwaysImportant, "shouldAlwaysMarkAsImportant" },
                { ActionPropertyType.NeverImportant, "shouldNeverMarkAsImportant" },
                { ActionPropertyType.SmartLabel, "smartLabelToApply" }
            }.AsReadOnly();
            _actionPropertyTypes = _actionPropertyNames.ToDictionary(o => o.Value, o => o.Key).AsReadOnly();

            _smartLabelNames = new Dictionary<SmartLabelType, string>()
            {
                { SmartLabelType.Personal, "^smartlabel_personal" },
                { SmartLabelType.Social, "^smartlabel_social" },
                { SmartLabelType.Promotions, "^smartlabel_promo" },
                { SmartLabelType.Notification, "^smartlabel_notification" },
                { SmartLabelType.Group, "^smartlabel_group" }
            }.AsReadOnly();
            _smartLabelTypes = _smartLabelNames.ToDictionary(o => o.Value, o => o.Key).AsReadOnly();

            _sizeOperatorNames = new Dictionary<SizeOperatorType, string>()
            {
                { SizeOperatorType.GreaterThan, "s_sl" },
                { SizeOperatorType.LessThan, "s_ss" }
            }.AsReadOnly();
            _sizeOperatorTypes = _sizeOperatorNames.ToDictionary(o => o.Value, o => o.Key).AsReadOnly();

            _sizeUnitNames = new Dictionary<SizeUnitType, string>()
            {
                { SizeUnitType.MB, "s_smb" },
                { SizeUnitType.KB, "s_skb" },
                { SizeUnitType.Byte, "s_sb" }
            }.AsReadOnly();
            _sizeUnitTypes = _sizeUnitNames.ToDictionary(o => o.Value, o => o.Key).AsReadOnly();
        }
开发者ID:ptownsend1984,项目名称:SampleApplications,代码行数:57,代码来源:MessageFilterComponent.cs

示例11: MarketHoursDatabase

 /// <summary>
 /// Initializes a new instance of the <see cref="MarketHoursDatabase"/> class
 /// </summary>
 /// <param name="exchangeHours">The full listing of exchange hours by key</param>
 public MarketHoursDatabase(IReadOnlyDictionary<SecurityDatabaseKey, Entry> exchangeHours)
 {
     _entries = exchangeHours.ToDictionary();
 }
开发者ID:pmerrill,项目名称:Lean,代码行数:8,代码来源:MarketHoursDatabase.cs

示例12: PropertiesDeploymentMatcher

 public PropertiesDeploymentMatcher(IReadOnlyDictionary<string, string> matchProperties)
 {
     _matchProperties = matchProperties.ToDictionary(pair => pair.Key, pair => pair.Value);
 }
开发者ID:Microsoft,项目名称:Yams,代码行数:4,代码来源:PropertiesDeploymentMatcher.cs

示例13: AppInstallConfig

 public AppInstallConfig(AppIdentity appIdentity, IReadOnlyDictionary<string, string> properties) : this(appIdentity)
 {
     Properties = properties.ToDictionary(pair => pair.Key, pair => pair.Value);
 }
开发者ID:Microsoft,项目名称:Yams,代码行数:4,代码来源:AppInstallConfig.cs

示例14: WriteDictionary

        /// <summary>
        /// Escape the name of the Property before calling ElasticSearch
        /// </summary>
        protected override void WriteDictionary(IReadOnlyDictionary<ScalarValue, LogEventPropertyValue> elements, TextWriter output)
        {
            var escaped = elements.ToDictionary(e => DotEscapeFieldName(e.Key), e => e.Value);

            base.WriteDictionary(escaped, output);
        }
开发者ID:leachdaniel,项目名称:serilog-sinks-elasticsearch,代码行数:9,代码来源:ElasticsearchJsonFormatter.cs

示例15: AsAttributes

 private static Dictionary<string, AttributeValue> AsAttributes(IReadOnlyDictionary<string, object> item)
 {
     return item.ToDictionary(i => i.Key, i => AsAttribute(i.Value));
 }
开发者ID:kingkino,项目名称:azure-documentdb-datamigrationtool,代码行数:4,代码来源:DynamoDbHelper.cs


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