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


C# System.Collections.Generic.All方法代码示例

本文整理汇总了C#中System.Collections.Generic.All方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.All方法的具体用法?C# System.Collections.Generic.All怎么用?C# System.Collections.Generic.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Generic的用法示例。


在下文中一共展示了System.Collections.Generic.All方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: should_check_if_each_and_every_item_in_sequence_match_prediction

        public void should_check_if_each_and_every_item_in_sequence_match_prediction()
        {
            var sequence = new[] { 2, 4, 6, 8, 10 };

            bool allEvenNumbers = sequence.All(item => item % 2 == 0);

            // please update variable value to fix the test.
            const bool expectedAllEvenNumbers = false;

            Assert.Equal(expectedAllEvenNumbers, allEvenNumbers);
        }
开发者ID:chenbojian,项目名称:01_NewbieVillage,代码行数:11,代码来源:24_LinqBasics.cs

示例2: Resolve_TwoGroups

        public void Resolve_TwoGroups()
        {
            //Arrange
            var group1 = new EasyADGroup { Id = 1, Name = "Group A", Sections = "content;media;", UserType = 1 };
            var group2 = new EasyADGroup { Id = 2, Name = "Group B", Sections = "translation;", UserType = 3 };
            var groups = new List<EasyADGroup> { group1, group2 };
            var expected = new[] { "content", "media", "translation" };

            //Act
            var actual = SectionResolver.Resolve(groups);

            //Assert
            Assert.AreEqual(3, actual.Length);
            Assert.IsTrue(expected.All(e => actual.Contains(e)));
        }
开发者ID:ThumNet,项目名称:EasyAD,代码行数:15,代码来源:SectionResolverTests.cs

示例3: WhenLevel1ThenMatch

 public void WhenLevel1ThenMatch()
 {
     var lelev0 = new PropertyPath(null, ForClass<MyClassWithComponent>.Property(x => x.Component1));
     var deppLevels = new[]
                      	{
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.Prop1)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.Prop2)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.MyNested)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.Collection)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.ManyToOne)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.OneToOne)),
                      		new PropertyPath(lelev0, ForClass<MyComponent>.Property(x => x.Any)),
                      	};
     var pattern = new ComponentMemberDeepPathPattern();
     deppLevels.All(pp => pp.Satisfy(x => pattern.Match(x)));
 }
开发者ID:alvarezdaniel,项目名称:conformando-nhibernate,代码行数:16,代码来源:ComponentMemberDeepPathPatternTest.cs

示例4: Should_get_located_views_from_view_location_provider_with_distinct_available_extensions_when_created

        public void Should_get_located_views_from_view_location_provider_with_distinct_available_extensions_when_created()
        {
            // Given
            var viewEngine1 = A.Fake<IViewEngine>();
            A.CallTo(() => viewEngine1.Extensions).Returns(new[] { "html" });

            var viewEngine2 = A.Fake<IViewEngine>();
            A.CallTo(() => viewEngine2.Extensions).Returns(new[] { "spark", "html" });

            var viewLocationProvider = A.Fake<IViewLocationProvider>();
            var expectedViewEngineExtensions = new[] { "html", "spark" };

            // When
            CreateViewLocationCache(
                viewLocationProvider,
                new[] { viewEngine1, viewEngine2 });

            // Then
            A.CallTo(() => viewLocationProvider.GetLocatedViews(A<IEnumerable<string>>.That.Matches(
                x => expectedViewEngineExtensions.All(y => x.Where(z => z.Equals(y)).Count() == 1)))).MustHaveHappened();
        }
开发者ID:nathanpalmer,项目名称:Nancy,代码行数:21,代码来源:DefaultViewLocationCacheFixture.cs

示例5: BindData

    /* Methods */

    /// <summary>
    /// The bind data.
    /// </summary>
    private void BindData()
    {
        bool found = false;

        if (this.Request.QueryString.GetFirstOrDefault("u") != null)
        {
            // Load the page access list.
            DataTable dt = LegacyDb.adminpageaccess_list(
                this.Request.QueryString.GetFirstOrDefault("u"), null);
            
            // Get admin pages by page prefixes.
            var listPages = Enum.GetNames(typeof(ForumPages)).Where(
                e => e.IndexOf("admin_", System.StringComparison.Ordinal) >= 0);
            
            // Initialize list with a helper class.
            var adminPageAccesses = new List<AdminPageAccess>();
            
            // Protected hostadmin pages
            var hostPages = new[] { "admin_boards", "admin_hostsettings", "admin_pageaccesslist", "admin_pageaccessedit", "admin_eventloggroups", "admin_eventloggroupaccess" };
            // Iterate thru all admin pages
            foreach (var listPage in listPages.ToList())
            {
                if (dt != null && dt.Rows.Cast<DataRow>().Any(dr => dr["PageName"].ToString() == listPage && hostPages.All(s => s != dr["PageName"].ToString())))
                {
                    found = true;
                    adminPageAccesses.Add(new AdminPageAccess
                    {
                        UserId = this.Request.QueryString.GetFirstOrDefault("u").ToType<int>(),
                        PageName = listPage,
                        ReadAccess = true
                    });
                }
                
                // If it doesn't contain page for the user add it.
                if (!found && hostPages.All(s => s != listPage))
                {
                    adminPageAccesses.Add(new AdminPageAccess
                    {
                        UserId = this.Request.QueryString.GetFirstOrDefault("u").ToType<int>(),
                        PageName = listPage,
                        ReadAccess = false
                    });
                }
                
                // Reset flag in the end of the outer loop
                found = false;
            }
          
            this.UserName.Text = this.HtmlEncode(this.Get<IUserDisplayName>().GetName(this.Request.QueryString.GetFirstOrDefault("u").ToType<int>()));
            
            // get admin pages list with access flags.
            this.AccessList.DataSource = adminPageAccesses.AsEnumerable();
        }
        this.DataBind();
    }
开发者ID:ransems,项目名称:YAFNET,代码行数:60,代码来源:pageaccessedit.ascx.cs

示例6: CaseThree

        public static void CaseThree()
        {
            List<CardTemplate> HandCards_BoardCards = MainLists.HandCards_BoardCards;

            if (ValueReader.ValueIgnorer.IgnoreValueIf_244_AndCoin &&
                ValueReader.ValueIgnorer.HandContains224(HandCards_BoardCards) &&
                !alreadyFoundOneCombo)
            {
                alreadyFoundOneCombo = true;
                var best2Drop =
                        HandCards_BoardCards.Where(x => new NeutralMinion(x).minionBoardCard != null && x.Cost == 2).
                            OrderBy(x => new NeutralMinion(x).thisCardValue).Last();
                var bestOther2Drop =
                        HandCards_BoardCards.Where(x => x.Id.ToString() != best2Drop.Id.ToString() &&
                            new NeutralMinion(x).minionBoardCard != null && x.Cost == 2).
                                OrderBy(x => new NeutralMinion(x).thisCardValue).Last();
                var best4Drop =
                        HandCards_BoardCards.Where(x => new NeutralMinion(x).minionBoardCard != null && x.Cost == 4).
                            OrderBy(x => new NeutralMinion(x).thisCardValue).Last();

                var bestDrops = new[] { best2Drop, bestOther2Drop, best4Drop };

                if (ValueReader.ValueIgnorer.OnlyAddIfNoBadEffect && !bestDrops.All(CardEffects.HasBadEffect))
                {
                    foreach (var drop in bestDrops.Where(x => !MainLists.chosenCards.Contains(BoardToMulliganCard(x))))
                    {
                        string dropAsString = drop.Id.ToString();
                        MainLists.chosenCards.Add(CardTemplate.StringToCard(dropAsString));
                        MainLists.blackList.Add(drop.Id.ToString());
                    }
                }
            }
        }
开发者ID:DanThePman,项目名称:Hearthstone,代码行数:33,代码来源:Combos.cs

示例7: ShowServicesAndCharacteristics

        private void ShowServicesAndCharacteristics(BluetoothConnectionHandler connectionHandler)
        {
            var listView = FindViewById<ListView>(Resource.Id.ServiceList);

            var filterUuid = new [] { UUID.FromString("00001800-0000-1000-8000-00805F9B34FB"),
                UUID.FromString("00001801-0000-1000-8000-00805F9B34FB"), UUID.FromString("7905F431-B5CE-4E99-A40F-4B1E122D00D0") };

            var serviceList = connectionHandler.GetServiceList().Where(s => filterUuid.All(uuid => !uuid.Equals(s.Uuid)));
            listView.Adapter = _adapter = CreateServiceListAdapter(serviceList);
            listView.ItemClick += OnItemClick;
        }
开发者ID:jardar,项目名称:AndroidBluetoothLE,代码行数:11,代码来源:ServiceListView.cs


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