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


C# SortedList.SelectMany方法代码示例

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


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

示例1: RunSuite

        public void RunSuite(Spec suite)
        {
            var mainSuiteExecutionPlan = new SortedList<string, List<Definition>>();
           // var mainSuiteExecutionPlan = new Dictionary<string, List<Definition>>();
            foreach (var spec in suite.Registry.ExecutableLookupTable)
            {
                mainSuiteExecutionPlan.Add(spec.Id, new List<Definition>());
                List<Definition> executionPlan = mainSuiteExecutionPlan[spec.Id];
                executionPlan.Add(spec);
                AddBeforeEachs(spec, executionPlan);              
                AddAfterEach(spec, executionPlan);
            }

            foreach (var executionPlan in mainSuiteExecutionPlan)
            {
                foreach (var definition in executionPlan.Value)
                {
                    if(definition.GetType() == typeof(GlobalHook))
                    {
                        var globalHook = (GlobalHook) definition;
                        if (globalHook.Kind == GlobalHookKind.BeforeAll)
                        {
                            if (globalHook.ExecutionStatus != ExecStatus.NotRun)
                                continue;
                        }

                        if (globalHook.Kind == GlobalHookKind.AfterAll)
                        {
                            var max = mainSuiteExecutionPlan.SelectMany(x => x.Value, (x, y) => new
                            {
                                x.Key,
                                val=y,
                                idx=mainSuiteExecutionPlan.IndexOfKey(x.Key)
                            })
                            .Where(x=>x.val==definition)
                            .Max(x=>x.idx);
                            var index = mainSuiteExecutionPlan.IndexOfKey(executionPlan.Key);
                            if (index<max)
                            {
                                continue;
                            }
                        }

                    }
                    SafeExecute(definition);
                }
                
            }
        }
开发者ID:leohinojosa,项目名称:spec,代码行数:49,代码来源:Agent.cs

示例2: ValidateCharacteristics

		/// <summary>
		/// The whole variables must be the same type.
		/// </summary>
		/// <param name="entities">object id,variable id, variable description</param>
		/// <returns></returns>
		private Return<object> ValidateCharacteristics(SortedList<int, SortedList<int, ICharacteristic>> entities)
		{
			Return<object> _answer = new Return<object>();
			try
			{
				int _minKey = entities.SelectMany(e => e.Value.Select(sl => sl.Key)).Min(k => k)
					, _maxKey = entities.SelectMany(e => e.Value.Select(sl => sl.Key)).Max(k => k);

				for (int _i = _minKey; _i <= _maxKey; _i++)
				{//characteristic to characteristic
					IEnumerable<SortedList<int, ICharacteristic>> _entitiesAll = entities.Select(e => e.Value);
					IEnumerable<SortedList<int, ICharacteristic>> _entitiesWithCharacteristic = _entitiesAll.Where(e => e.ContainsKey(_i));
					if (_entitiesWithCharacteristic.Any())
					{
						IEnumerable<ICharacteristic> _listOfCharacteristic = _entitiesWithCharacteristic.Select(e => e[_i]);
						IEnumerable<IGrouping<Type, ICharacteristic>> _groupByType = _listOfCharacteristic.GroupBy(c => c.GetType());
						if (_groupByType.Count() > 1)
						{
							string _message = string.Format("There are different types in characteristic {1}{0} ", Environment.NewLine, Convert.ToString(_i));
							_answer.theresError = true;
							_answer.error = Utility.GetError(new Exception(_message), this.GetType());
						}
					}

					if (_answer.theresError)
						break;
				}//characteristic to characteristic
			}
			catch (Exception _ex)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(_ex, this.GetType());
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:40,代码来源:GroupingUtility.cs

示例3: FillHoles

		/// <summary>
		/// 
		/// </summary>
		/// <param name="entities">object id,variable id, variable description</param>
		/// <returns></returns>
		private Return<object> FillHoles(SortedList<int, SortedList<int, ICharacteristic>> entities)
		{
			Return<object> _answer = new Return<object>();
			try
			{
				int _minKey = entities.SelectMany(e => e.Value.Select(sl => sl.Key)).Min(k => k)
					, _maxKey = entities.SelectMany(e => e.Value.Select(sl => sl.Key)).Max(k => k);

				for (int _i = _minKey; _i <= _maxKey; _i++)
				{//characteristic to characteristic
					IEnumerable<SortedList<int, ICharacteristic>> _entitiesAll = entities.Select(e => e.Value);
					IEnumerable<SortedList<int, ICharacteristic>> _entitiesWithCharacteristic = _entitiesAll.Where(e => e.ContainsKey(_i));
					IEnumerable<SortedList<int, ICharacteristic>> _entitiesWithoutTheCharacteristic = _entitiesAll.Except(_entitiesWithCharacteristic);

					if (_entitiesWithCharacteristic.Any())
					{
						IEnumerable<ICharacteristic> _listOfCharacteristic = _entitiesWithCharacteristic.SelectMany(o => o.Values);
						ICharacteristic _characteristic = _listOfCharacteristic.First();
						ICharacteristic _filler = _characteristic.FillHole(_listOfCharacteristic);
						foreach (SortedList<int, ICharacteristic> _list in _entitiesWithoutTheCharacteristic)
							_list.Add(_i, _filler.Clone());
					}
				}//characteristic to characteristic
			}
			catch (Exception _ex)
			{
				_answer.theresError = true;
				_answer.error = Utility.GetError(_ex, this.GetType());
			}
			return _answer;
		}
开发者ID:meras0704,项目名称:Solution_Blatella.ML,代码行数:36,代码来源:GroupingUtility.cs


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