本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.OrderBy方法的具体用法?C# System.Collections.Generic.List.OrderBy怎么用?C# System.Collections.Generic.List.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.OrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: stitchUnRestrictedSubCalendarEvent
List<mTuple<bool, SubCalendarEvent>> stitchUnRestrictedSubCalendarEvent(TimeLine FreeBoundary, List<mTuple<bool, SubCalendarEvent>> restrictedSnugFitAvailable, Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> PossibleEntries, Dictionary<TimeSpan, mTuple<int, TimeSpanWithStringID>> CompatibleWithList,double Occupancy)
{
TimeLine[] AllFreeSpots = FreeBoundary.getAllFreeSlots();
int TotalEventsForThisTImeLine = 0;
foreach (KeyValuePair<TimeSpan, mTuple<int, TimeSpanWithStringID>> eachKeyValuePair in CompatibleWithList)
{
TotalEventsForThisTImeLine += eachKeyValuePair.Value.Item1;
}
CompatibleWithList.Clear();
DateTime EarliestReferenceTIme = FreeBoundary.Start;
List<mTuple<bool, SubCalendarEvent>> FrontPartials = new System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>();
List<mTuple<bool, SubCalendarEvent>> EndPartials = new System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>();
Dictionary<DateTime, List<mTuple<bool, SubCalendarEvent>>> FrontPartials_Dict = new System.Collections.Generic.Dictionary<DateTime, System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>>();
Dictionary<DateTime, List<mTuple<bool, SubCalendarEvent>>> EndPartials_Dict = new System.Collections.Generic.Dictionary<DateTime, System.Collections.Generic.List<mTuple<bool, SubCalendarEvent>>>();
Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> PossibleEntries_Cpy = new Dictionary<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>>();
Dictionary<string, Dictionary<string, SubCalendarEvent>> CalendarIDAndNonPartialSubCalEvents = new Dictionary<string, Dictionary<string, SubCalendarEvent>>();//List of non partials for current Reference StartTime To End of FreeBoundary. Its gets updated with Partials once the earliest reference time passes the partial event start time
foreach (KeyValuePair<TimeSpan, Dictionary<string, mTuple<bool, SubCalendarEvent>>> eachKeyValuePair in PossibleEntries)//populates PossibleEntries_Cpy. I need a copy to maintain all references to PossibleEntries
{
Dictionary<string, mTuple<bool, SubCalendarEvent>> NewDictEntry = new Dictionary<string, mTuple<bool, SubCalendarEvent>>();
foreach (KeyValuePair<string, mTuple<bool, SubCalendarEvent>> KeyValuePair0 in eachKeyValuePair.Value)
{
mTuple<bool, SubCalendarEvent> MyEvent = KeyValuePair0.Value;
if (MyEvent.Item2.ID == "469_471")
{
;
}
bool isInrestrictedSnugFitAvailable = false;
if (CompatibleWithList.ContainsKey(eachKeyValuePair.Key))
{
++CompatibleWithList[eachKeyValuePair.Key].Item1;
}
else
{
CompatibleWithList.Add(eachKeyValuePair.Key, new mTuple<int, TimeSpanWithStringID>(1, new TimeSpanWithStringID(KeyValuePair0.Value.Item2.ActiveDuration, KeyValuePair0.Value.Item2.ActiveDuration.Ticks.ToString())));
}
foreach (mTuple<bool, SubCalendarEvent> eachMtuple in restrictedSnugFitAvailable)//checks if event is in restricted list
{
if (eachMtuple.Item2.ID == MyEvent.Item2.ID)
{
isInrestrictedSnugFitAvailable = true;
break;
}
}
if (!isInrestrictedSnugFitAvailable)
{
NewDictEntry.Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value);
if (FreeBoundary.IsDateTimeWithin(KeyValuePair0.Value.Item2.getCalendarEventRange.Start))
{
FrontPartials.Add(KeyValuePair0.Value);
}
else
{
if (FreeBoundary.IsDateTimeWithin(KeyValuePair0.Value.Item2.getCalendarEventRange.End))
{
EndPartials.Add(KeyValuePair0.Value);
}
else
{
string CalLevel0ID=KeyValuePair0.Value.Item2.SubEvent_ID.getLevelID(0);
if (CalendarIDAndNonPartialSubCalEvents.ContainsKey(CalLevel0ID))
{
CalendarIDAndNonPartialSubCalEvents[CalLevel0ID].Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value.Item2);
}
else
{
//CalendarIDAndNonPartialSubCalEvents.Add(CalLevel0ID, new List<SubCalendarEvent>() { KeyValuePair0.Value.Item2 });
CalendarIDAndNonPartialSubCalEvents.Add(CalLevel0ID, new Dictionary<string, SubCalendarEvent>());
CalendarIDAndNonPartialSubCalEvents[CalLevel0ID].Add(KeyValuePair0.Value.Item2.ID, KeyValuePair0.Value.Item2);
}
}
}
}
}
if (NewDictEntry.Count > 0)
{ PossibleEntries_Cpy.Add(eachKeyValuePair.Key, NewDictEntry); }
}
FrontPartials = FrontPartials.OrderBy(obj => obj.Item2.getCalendarEventRange.Start).ToList();
EndPartials = EndPartials.OrderBy(obj => obj.Item2.getCalendarEventRange.End).ToList();
foreach (mTuple<bool, SubCalendarEvent> eachmTuple in FrontPartials)//populates FrontPartials_Dict in ordered manner since FrontPartials is ordered
{
if (FrontPartials_Dict.ContainsKey(eachmTuple.Item2.getCalendarEventRange.Start))
{
FrontPartials_Dict[eachmTuple.Item2.getCalendarEventRange.Start].Add(eachmTuple);
}
//.........这里部分代码省略.........
示例2: Process
/// <summary>
/// Processes the assets
/// </summary>
/// <param name="Assets">Assets to process</param>
/// <param name="Context">The bundle context</param>
/// <param name="Response">The bundle response</param>
public void Process(IList<IAsset> Assets, BundleContext Context, BundleResponse Response)
{
foreach (IFilter Filter in Filters.Where(x => x.TimeToRun == RunTime.PreTranslate))
{
Assets = Filter.Filter(Assets);
}
foreach (ITranslator Translator in Translators)
{
Assets = Translator.Translate(Assets);
}
foreach (RunTime Item in RunOrder)
{
foreach (IFilter Filter in Filters.Where(x => x.TimeToRun == Item))
{
Assets = Filter.Filter(Assets);
}
}
string Content = Assets.OrderBy(x => x.Path).ToString(x => x.ToString(), "");
foreach (IContentFilter Filter in ContentFilters)
{
Content = Filter.Filter(Content);
}
System.Collections.Generic.List<BundleFile> Files = new System.Collections.Generic.List<BundleFile>();
foreach (IAsset Asset in Assets)
{
if (Asset.Path.StartsWith("~") || Asset.Path.StartsWith("/"))
{
Files.Add(new BundleFile(Asset.Path, new VirtualFileHack(Asset.Path)));
Files.Add(Asset.Included.Where(x => x.Path.StartsWith("~") || x.Path.StartsWith("/")).Select(x => new BundleFile(x.Path, new VirtualFileHack(x.Path))));
}
}
Response.Content = Content;
Response.Files = Files.OrderBy(x => x.VirtualFile.VirtualPath);
Response.ContentType = Assets.First().Type == AssetType.CSS ? "text/css" : "text/javascript";
Response.Cacheability = HttpCacheability.ServerAndPrivate;
}
示例3: Initialize
/// <summary>
/// Initializes the mappings
/// </summary>
public void Initialize()
{
System.Collections.Generic.List<IMapping> TempMappings = new System.Collections.Generic.List<IMapping>();
foreach (Type Key in Mappings.Keys)
{
foreach (IMapping Mapping in Mappings[Key])
{
TempMappings.Add(Mapping);
}
}
foreach (IMapping Mapping in TempMappings.OrderBy(x => x.Order))
{
Mapping.Initialize();
}
}