当前位置: 首页>>代码示例>>C#>>正文


C# Collection.All方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:unsalersoz,项目名称:Extensions,代码行数:35,代码来源:DataRowExtensions.cs

示例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);
 }
开发者ID:charlesmarques,项目名称:ASPNETmvcNaPratica,代码行数:10,代码来源:PessoaController.cs

示例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);
 }
开发者ID:asr0,项目名称:ValidacaoDataAnottationsAsp.netMVC,代码行数:12,代码来源:PessoaController.cs

示例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");
            }
        }
开发者ID:klym1,项目名称:Gpak-tools,代码行数:15,代码来源:BlocksDistributor.cs

示例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;
        }
开发者ID:pwibeck,项目名称:InstallerVerificationFramework,代码行数:10,代码来源:TestDataLoader.cs


注:本文中的Collection.All方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。