本文整理汇总了C#中Collection.All方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.All方法的具体用法?C# Collection.All怎么用?C# Collection.All使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.All方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Distinct
public static IEnumerable<DataRow> Distinct(this IEnumerable<DataRow> dataRowCollection, DataTable schemaTable, byte distinctIndex)
{
ICollection<object[]> objectArrayCollection = new Collection<object[]>();
foreach (DataRow dataRow in dataRowCollection)
{
if (!objectArrayCollection.Any())
{
objectArrayCollection.Add(dataRow.ItemArray);
}
else
{
if (objectArrayCollection.All(
distinctDataRowArray =>
{
object dateColumnInDataRow = dataRow.ItemArray[distinctIndex];
object distinctDateColumnInCollection = distinctDataRowArray[distinctIndex];
return (dataRow.ItemArray.Length == distinctDataRowArray.Length)
&& ((dateColumnInDataRow != null) && (distinctDateColumnInCollection != null)
&& !dataRow.ItemArray.SequenceEqual(distinctDataRowArray));
}))
{
objectArrayCollection.Add(dataRow.ItemArray);
}
}
}
foreach (object[] objectArray in objectArrayCollection)
{
DataRow newRow = schemaTable.NewRow();
newRow.ItemArray = objectArray;
yield return newRow;
}
}
示例2: LoginUnico
public ActionResult LoginUnico(string login)
{
var bancoDeNomesDeExemplo = new Collection<string>
{
"Cleyton",
"Anderson",
"Renata"
};
return Json(bancoDeNomesDeExemplo.All(x => x.ToLower() != login.ToLower()), JsonRequestBehavior.AllowGet);
}
示例3: LoginUnico
public ActionResult LoginUnico(string login)
{
var banco = new Collection<string>
{
"Cleyton",
"Anderson",
"Fernanda",
"Alex",
"Marciel"
};
return Json(banco.All(x => x.ToLower() != login.ToLower()), JsonRequestBehavior.AllowGet);
}
示例4: VerifyBlockContainerCollection
private void VerifyBlockContainerCollection(Collection<AbsoluteBlockContainer> blockContainerCollection)
{
var numberOfZeroLengthed = blockContainerCollection.Count(it => it.TotalSpaceOccupied == 0);
if (numberOfZeroLengthed > 0)
{
// throw new Exception("numberOfZeroLengthed > 0");
}
var all = blockContainerCollection.All(it => it.TotalSpaceOccupied == it.Block.Length);
if (!all)
{
throw new Exception("23423");
}
}
示例5: LoadInstallChainerComponentData
private static Collection<InstallChainerComponent> LoadInstallChainerComponentData(XElement xdoc, string filePath, ICollection<MsiFile> msifiles, ICollection<PluginData> plugins, ICollection<DataProperty> properties)
{
var components = new Collection<InstallChainerComponent>();
foreach (var comp in xdoc.Descendants().Where(x => x.Name.LocalName == "component").Select(componentNode => CreateInstallChainerComponent(componentNode, filePath, msifiles, plugins, properties)).Where(comp => components.All(x => x.Id != comp.Id)))
{
components.Add(comp);
}
return components;
}