本文整理匯總了C#中Model.List.Concat方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Concat方法的具體用法?C# List.Concat怎麽用?C# List.Concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model.List
的用法示例。
在下文中一共展示了List.Concat方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateRouteFromMultiLineString
public void CreateRouteFromMultiLineString(DJ_TourGroup group, string multiLineString, out string errMsg)
{
errMsg = string.Empty;
group.Routes.Clear();
IList<DJ_Route> allRoutes = new List<DJ_Route>();
string[] arrSingleLine = multiLineString.Split(Environment.NewLine.ToCharArray()).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
Dictionary<EnterpriseType, IList<String>> entDicts = new Dictionary<EnterpriseType, IList<string>>();
for (int i = 1; i <= arrSingleLine.Length; i++)
{
int dayNo = i;
string currentLine = arrSingleLine[i - 1];
string[] diffEnts = currentLine.Split(new char[] { ';', ';' });
if (diffEnts.Length > 2 || diffEnts.Length == 0)
{
errMsg = "格式錯誤:請用分號將景點和賓館隔開." + currentLine;
return;
}
List<string> entNames = diffEnts[0].Split(new char[] { '\\', '\', '、' }).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
entDicts.Add(EnterpriseType.景點, entNames);
List<string> entHotels = new List<string>();
if (diffEnts.Length == 2)
{
entHotels = diffEnts[1].Split(new char[] { '\\', '\', '、' }).Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
entDicts.Add(EnterpriseType.賓館, entNames);
}
IList<DJ_Route> dayRoutes = CreateRouteFromNameList(dayNo, entDicts, out errMsg).Cast<DJ_Route>().ToList();
allRoutes = allRoutes.Concat(dayRoutes).ToList();
}
foreach (DJ_Route r in allRoutes)
{
group.Routes.Add(r);
}
// group.Routes = allRoutes;
// return allRoutes;
}