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


C# MultiDictionary.TryGetValue方法代码示例

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


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

示例1: ProcessIO

        /// <summary>
        /// Processes the IO.
        /// </summary>
        /// <param name="componentTemplateIODictionary">The io dictionary of either Inputs of Outputs of the component template.</param>
        /// <param name="settings">input or output settings for the composite component that is being defined</param>
        /// <param name="benchmarkMappingSettingsCollection">The benchmark setting collection .</param>
        private static void ProcessIO(IDictionary<string, IOItem> componentTemplateIODictionary, SortedDictionary<string, ItemSetting> settings, BenchmarkSettingCollection<IOItem> benchmarkMappingSettingsCollection)
        {
            MultiDictionary<string, ItemSetting> lookupByType = new MultiDictionary<string, ItemSetting>();

            //first prepare lookup by type 
            foreach (KeyValuePair<string, ItemSetting> pair in settings)
            {
                ItemSetting item = pair.Value;
                //as default don't include it
                item.Include = false;
                lookupByType.Add(item.Type, item);
            }

            foreach (string itemKey in componentTemplateIODictionary.Keys)
            {
                IOItem item = componentTemplateIODictionary[itemKey];

                //check if there are any item settings with matching type
                IEnumerable<ItemSetting> matchingItemSettings;
                if (lookupByType.TryGetValue(item.IOItemDefinition.Type, out matchingItemSettings))
                {
                    ItemSettingCollection list = new ItemSettingCollection(matchingItemSettings);

                    //add all to the candidate matching items - these are items that user can choose from
                    var setting = new BenchmarkItemSetting<IOItem>(item, list);
                    benchmarkMappingSettingsCollection.Add(setting);
                    setting.SelectedSetting = setting.CandidateSettings[0];
                }
                else
                {
                    //add empty list - no matching items - benchmarking cannot be executed
                    var setting = new BenchmarkItemSetting<IOItem>(item, new ItemSettingCollection());
                    benchmarkMappingSettingsCollection.Add(setting);
                }
            }
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:42,代码来源:Benchmark.cs


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