本文整理汇总了C#中BindingList.Any方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Any方法的具体用法?C# BindingList.Any怎么用?C# BindingList.Any使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Any方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: add
private void add(BindingList<BondSpreadLine> list_, CountryBondSource src1_, CountryBondSource src2_, bool firstFirst_)
{
Array.ForEach(src1_.Lines.ToArray(), benchBond =>
{
var closestBond =
src2_.Lines.Select(x => new { Diff = Math.Abs((benchBond.Maturity - x.Maturity).TotalDays), Item = x })
.OrderBy(x => x.Diff)
.First();
if (closestBond.Diff > DaysDiffTolerance) return;
var line = firstFirst_ ? new BondSpreadLine(benchBond, closestBond.Item) : new BondSpreadLine(closestBond.Item, benchBond);
if (
list_.Any(
x => object.ReferenceEquals(x.Lines[0], line.Lines[0]) && object.ReferenceEquals(x.Lines[1], line.Lines[1])))
line.Dispose();
else
list_.Add(line);
});
}
示例2: SetDataSource
public void SetDataSource(BindingList<string> datasource)
{
this.StringBindingList = new BindingList<StringObject>();
this.origDataSource = datasource;
var items = from s in datasource orderby s select s;
foreach (var s in items)
{
if (!StringBindingList.Any(item => item.Text == s))
{
StringBindingList.Add(new StringObject { Text = s });
}
}
this.SetDataSourceList();
gridControl.DataSource = StringBindingList;
gridControl.Enabled = true;
StringBindingList.AddingNew += this.StringBindingList_AddingNew;
StringBindingList.ListChanged += this.StringBindingList_ListChanged;
}
示例3: UpdateItemOnGrid
private void UpdateItemOnGrid(BindingList<MarketViewItem> marketViewItems, MarketViewItem marketItem)
{
if (marketViewItems.Any(m => m.Instrument == marketItem.Instrument))
{
for (int i = 0; i < marketViewItems.Count; i++)
{
if (marketViewItems[i].Instrument == marketItem.Instrument)
{
marketViewItems[i] = marketItem;
}
}
}
else
{
marketViewItems.Add(marketItem);
}
}
示例4: DeleteConcreteEntities
public void DeleteConcreteEntities(BindingList<TestForGrid> testGrids, BindingList<SpecimenForGrid> specimenGrids, BindingList<TubeForGrid> tubeGrids, BindingList<IndicationForGrid> indicationGrids, string orderNumber)
{
var oldConcreteTests = OrderService.FindConcreteTestsByOrder(orderNumber);
foreach (var oldConcreteTest in oldConcreteTests)
{
if (!testGrids.Any(testGrid => testGrid.ConcreteCode == oldConcreteTest.Code))
{
OrderService.DeleteConcreteTest(oldConcreteTest.Code);
}
}
var oldConcreteSpecimens = OrderService.FindConcreteSpecimensByOrder(orderNumber);
foreach (var oldConcreteSpecimen in oldConcreteSpecimens)
{
if (specimenGrids.SingleOrDefault<SpecimenForGrid>(specimenGrid => specimenGrid.ConcreteCode == oldConcreteSpecimen.Code) == null)
{
OrderService.DeleteConcreteSpecimen(oldConcreteSpecimen.Code);
}
}
var oldConcreteTubes = OrderService.FindConcreteTubesByOrder(orderNumber);
foreach (var oldConcreteTube in oldConcreteTubes)
{
if (tubeGrids.SingleOrDefault<TubeForGrid>(tubeGrid => tubeGrid.ConcreteCode == oldConcreteTube.Code) == null)
{
OrderService.DeleteConcreteTube(oldConcreteTube.Code);
}
}
var oldConcreteIndications = OrderService.FindConcreteIndicationsByOrder(orderNumber);
foreach (var oldConcreteIndication in oldConcreteIndications)
{
if (indicationGrids.SingleOrDefault<IndicationForGrid>(indicationGrid => indicationGrid.ConcreteCode == oldConcreteIndication.Code) == null)
{
OrderService.DeleteConcreteIndication(oldConcreteIndication.Code);
}
}
}