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


C# List.Count方法代码示例

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


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

示例1: CanCreateAt

        /// <summary>
        /// Determines whether an <see cref="Appointment"/> can be created at the specified <paramref name="start"/> time until the specified <paramref name="end"/> time.
        /// </summary>
        /// <param name="moduleId">The ID of the module in which the appointment is to be created.</param>
        /// <param name="start">The start of the new <see cref="Appointment"/>.</param>
        /// <param name="end">The end of the new <see cref="Appointment"/>.</param>
        /// <param name="max">The maximum appointments allowed for the specified time range</param>
        /// <returns>
        /// <c>true</c> if an <see cref="Appointment"/> can be created at the specified <paramref name="start"/> time until the specified <paramref name="end"/> time; otherwise, <c>false</c>.
        /// </returns>
        public static bool CanCreateAt(int moduleId, DateTime start, DateTime end, int? max)
        {
            var appointments = AppointmentSqlDataProvider.GetConcurrentAppointments(moduleId, start, end);
            var appointmentsInRange = new List<Appointment>(max ?? 10);

            while (appointments.Read())
            {
                appointmentsInRange.Add(Fill(appointments));
            }

            var uniqueStartTimes = appointmentsInRange.Select(apt => apt.StartDateTime).Distinct();
            return uniqueStartTimes.All(time => max > appointmentsInRange.Count(apt => time >= apt.StartDateTime && time < apt.EndDateTime));
        }
开发者ID:EngageSoftware,项目名称:Engage-Booking,代码行数:23,代码来源:Appointment.cs

示例2: HitsReceived

        public int HitsReceived(Entity target, Entity source, bool timed)
        {
            var sourceString = source?.Id.ToString() ?? "";
            var key = "hits_received/" + target + "/" + sourceString + "/" + timed;
            if (_caching.ContainsKey(key)) return (int) _caching[key];

            IEnumerable<Skill> result= new List<Skill>();
            if (TargetSourceSkill.ContainsKey(target))
            {
                if (!timed && source != null)
                {
                    if (TargetSourceSkill[target].ContainsKey(source))
                    {
                        result = from skills in TargetSourceSkill[target][source]
                            where skills.Type == Database.Type.Damage
                            select skills;
                    }
                }
                else
                {
                    result = from skills in TargetSourceSkill[target].Values
                        from skill in skills
                        where skill.Type == Database.Type.Damage
                        select skill;
                }
            }

            var count = result.Count();
            _caching.Add(key, count);
            return count;
        }
开发者ID:neowutran,项目名称:ShinraMeter,代码行数:31,代码来源:Skills.cs


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