本文整理匯總了C#中WebApplication1.List.Sort方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Sort方法的具體用法?C# List.Sort怎麽用?C# List.Sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebApplication1.List
的用法示例。
在下文中一共展示了List.Sort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: QtrClassSearch
//searches for classes that are available this quarter that student meets requirements for
protected List<string> QtrClassSearch()
{
List<string> currentClasses = new List<string>();
List<string> needed = new List<string>();
List<int> reqList = new List<int>();
int count;
if (date[1] == 3 || date[1] == 4) count = SummerN;
else count = QtrN;
//if you still need intro courses, you can't take any else
if (introNeeded)
{
reqList = new List<int>(introReqID);
reqList.Sort();
foreach (int ReqID in reqList)
{
//gets classes offered that have met prereqs
needed = ClassesOffered(ReqID);
while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
{
string course = needed[0];
needed.Remove(course);
ReqIDClassesNeeded[ReqID].Remove(course);
if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
{
ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
count = count - 1;
currentClasses.Add(course);
}
}
}
if (checkIntro()) introNeeded = false;
}
//searches for main courses
else
{
reqList = new List<int>(mainReqID);
reqList.Sort();
foreach (int ReqID in reqList)
{
//gets classes offered that have met prereqs
needed = ClassesOffered(ReqID);
while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
{
string course = needed[0];
needed.Remove(course);
ReqIDClassesNeeded[ReqID].Remove(course);
//if(course == "GAM 690") resultsBox.Items.Add(new ListItem("Looking at " + course + "in qtrSearch", course));
if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
{
ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
count = count - 1;
currentClasses.Add(course);
}
}
}
}
//adds classes to studenthistory
foreach (string cl in currentClasses) { studentHistory.Add(cl); }
return currentClasses;
}