本文整理汇总了C#中Data.List.Exists方法的典型用法代码示例。如果您正苦于以下问题:C# List.Exists方法的具体用法?C# List.Exists怎么用?C# List.Exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.List
的用法示例。
在下文中一共展示了List.Exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEssayCategories
public List<Category> GetEssayCategories()
{
var categories = new List<Category>();
foreach (var essayDictItem in essaysDictionary)
{
if (!categories.Exists(e => e.Name == essayDictItem.Value.Category))
{
categories.Add(new Category(essayDictItem.Value.Category));
}
categories.Single(e => e.Name == essayDictItem.Value.Category).EssaysForCategory.Add(
new EssayForCategory(essayDictItem.Value.Title, essayDictItem.Key, essayDictItem.Value.PublishInfo.OriginalPublishDate));
}
categories.ForEach(c => c.EssaysForCategory = c.EssaysForCategory.OrderByDescending(e => e.PublishDate).ToList());
return categories;
}
示例2: ThemMoi
private int ThemMoi(BOXuLyKho item, List<BOXuLyKhoChiTiet> lsArray, Transit mTransit)
{
if (lsArray != null)
{
List<Data.TONKHOTONG> lsTonKhoTong = new List<TONKHOTONG>();
List<Data.TONKHO> lsTonKho = new List<TONKHO>();
foreach (BOXuLyKhoChiTiet line in lsArray)
{
IQueryable<Data.TONKHO> lsArrayLine = null;
switch (item.XuLyKho.LoaiID)
{
case 1:
lsArrayLine = frmTonKho.Query().Where(s => s.DonViID == line.TonKho.DonViID && s.MonID == line.TonKho.MonID && s.KhoID == item.XuLyKho.KhoID && s.SoLuongTon > 0).OrderBy(s => s.NgayHetHan).ThenBy(s => s.TonKhoID);
if (lsArrayLine.Count() > 0 && line.TonKho.SoLuongNhap < lsArrayLine.Sum(s => s.SoLuongTon) && line.TonKho.SoLuongNhap > 0)
{
foreach (var l in lsArrayLine)
{
if (line.TonKho.SoLuongNhap > 0)
{
Data.TONKHOTONG tonkhotong = null;
if (lsTonKhoTong.Exists(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID))
{
tonkhotong = lsTonKhoTong.Find(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID);
}
else
{
tonkhotong = KiemTraTonKhoTong(frmTonKhoTong, (int)item.XuLyKho.KhoID, (int)line.TonKho.MonID, (int)line.TonKho.DonViID);
lsTonKhoTong.Add(tonkhotong);
}
tonkhotong.SoLuongTon += line.TonKho.SoLuongNhap;
tonkhotong.SoLuongDieuChinh += line.TonKho.SoLuongNhap;
Data.TONKHO tonkho = null;
if (lsTonKho.Exists(s => s.TonKhoID == l.TonKhoID))
{
tonkho = lsTonKho.Find(s => s.TonKhoID == l.TonKhoID);
}
else
{
tonkho = l;
lsTonKho.Add(tonkho);
}
line.XuLyKhoChiTiet.TONKHO = new TONKHO();
line.XuLyKhoChiTiet.TONKHO.PhatSinhTuTonKhoID = tonkho.TonKhoID;
line.XuLyKhoChiTiet.TONKHO.LoaiPhatSinhID = (int)item.XuLyKho.LoaiID;
CopyTonKho(line.XuLyKhoChiTiet.TONKHO, tonkho);
if (tonkho.SoLuongTon > line.TonKho.SoLuongNhap)
{
line.XuLyKhoChiTiet.TONKHO.SoLuongPhatSinh = tonkho.SoLuongTon - line.TonKho.SoLuongNhap;
tonkho.SoLuongTon += line.TonKho.SoLuongNhap;
line.TonKho.SoLuongNhap = 0;
}
else
{
line.XuLyKhoChiTiet.TONKHO.SoLuongPhatSinh = line.TonKho.SoLuongNhap - tonkho.SoLuongTon;
line.TonKho.SoLuongNhap += tonkho.SoLuongTon;
tonkho.SoLuongTon = 0;
}
}
}
}
break;
case 2:
case 3:
lsArrayLine = frmTonKho.Query().Where(s => s.DonViID == line.TonKho.DonViID && s.MonID == line.TonKho.MonID && s.KhoID == item.XuLyKho.KhoID && s.SoLuongTon > 0).OrderBy(s => s.NgayHetHan).ThenBy(s => s.TonKhoID);
if (lsArrayLine.Count() > 0 && line.TonKho.SoLuongNhap < lsArrayLine.Sum(s => s.SoLuongTon) && line.TonKho.SoLuongNhap > 0)
{
foreach (var l in lsArrayLine)
{
if (line.TonKho.SoLuongNhap > 0)
{
Data.TONKHOTONG tonkhotong = null;
if (lsTonKhoTong.Exists(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID))
{
tonkhotong = lsTonKhoTong.Find(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID);
}
else
{
tonkhotong = KiemTraTonKhoTong(frmTonKhoTong, (int)item.XuLyKho.KhoID, (int)line.TonKho.MonID, (int)line.TonKho.DonViID);
lsTonKhoTong.Add(tonkhotong);
}
tonkhotong.SoLuongTon -= line.TonKho.SoLuongNhap;
if (item.XuLyKho.LoaiID == 2)
{
tonkhotong.SoLuongMat += line.TonKho.SoLuongNhap;
}
if (item.XuLyKho.LoaiID == 3)
{
tonkhotong.SoLuongHu += line.TonKho.SoLuongNhap;
}
Data.TONKHO tonkho = null;
if (lsTonKho.Exists(s => s.TonKhoID == l.TonKhoID))
{
tonkho = lsTonKho.Find(s => s.TonKhoID == l.TonKhoID);
}
else
{
tonkho = l;
lsTonKho.Add(tonkho);
//.........这里部分代码省略.........
示例3: znajdzDrogePowrotnaRek
//.........这里部分代码省略.........
break;
case 0:
koszt += cennikSwiata.rotateCost;
if (kierunek[1] == 1)
{
firstStep = 2;
}
else
{
firstStep = 3;
}
break;
case -1:
firstStep = 1;
break;
};
break;
}
overalCost = koszt;
}
#endregion
#region ifZachod
//Sprawdzenie, czy idziemy na wschod czy na zachod.
else if (mojaPozycjaX - x > 0)
{
ZbadanePole nextStep = ZnanaMapa.znajdzPole(x + 1, y);
before.Add(new Wspolrzedne(x, y));
if (nextStep != null)
if (!((nextStep.getPrzeszkoda()) || (nextStep.getUnrechable())))
{
int nextKier = 3;
int[] temp = new int[2];
temp[0] = upCost;
if (!before.Exists(delegate(Wspolrzedne w)
{
if ((w.x == x + 1) && (w.y == y))
return true;
else
return false;
}))
{
if (before.Count > 1)
{
ZbadanePole tuStoje = ZnanaMapa.znajdzPole(x, y);
int nowaWysokosc = nextStep.getWysokosc();
temp[0] += cennikSwiata.moveCost;
temp[0] += Convert.ToInt32(Math.Ceiling(Convert.ToDouble
(cennikSwiata.moveCost * (nowaWysokosc - tuStoje
.getWysokosc())) / 100));
if ((lastKier == 0) || (lastKier == 2))
temp[0] += cennikSwiata.rotateCost;
if (lastKier == 1)
temp[0] += cennikSwiata.rotateCost * 2;
}
temp = znajdzDrogePowrotnaRek(x + 1, y, nextKier, before, temp[0], limit);
if (overalCost > temp[0])
{
overalCost = temp[0];
firstStep = temp[1];
}
}
}
if (mojaPozycjaY - y > 0)
{
示例4: GetEssayYears
public List<Year> GetEssayYears()
{
var years = new List<Year>();
foreach (var essayDictItem in essaysDictionary)
{
if (!years.Exists(e => e.YearValue == essayDictItem.Value.PublishYear))
{
years.Add(new Year(essayDictItem.Value.PublishYear));
}
years.Single(e => e.YearValue == essayDictItem.Value.PublishYear).EssaysForYear.Add(
new EssayForYear(essayDictItem.Value.Title, essayDictItem.Key, essayDictItem.Value.Category, essayDictItem.Value.PublishInfo.OriginalPublishDate));
}
years.ForEach(c => c.EssaysForYear = c.EssaysForYear.OrderByDescending(e => e.PublishDate).ToList());
return years.OrderByDescending(y => y.YearValue).ToList();
}