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


C# List.Distinct方法代码示例

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


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

示例1: GetUserRoles

        public List<Role> GetUserRoles(string username)
        {
            var result = new List<Role>();

            var existingUser = this.userRepository.GetSingleByUsername(username);

            if (existingUser != null)
            {
                result = this.GetUserRoles(existingUser);
            }

            return result.Distinct().ToList();
        }
开发者ID:nOBITa3001,项目名称:dh,代码行数:13,代码来源:MembershipService.cs

示例2: ProcessImagesForXmlList

        /// <summary>
        /// Process all the images for the given list of images
        /// retrieved from the sites HTML - this processes all images
        /// in a given list of xml nodes for the sitemap.
        /// </summary>
        /// <param name="xmlNodeList"></param>
        /// <param name="siteMapUrl"></param>
        /// <param name="squishedCssImages"></param>
        /// <returns></returns>
        public IEnumerable<string> ProcessImagesForXmlList(XmlNodeList xmlNodeList, string siteMapUrl, ref List<SquishedImage> squishedCssImages)
        {
            List<SquishedImage> images = new List<SquishedImage>();
            List<string> imageList = new List<string>();
            List<string> alreadyProcessed = new List<string>();

            foreach (XmlNode node in xmlNodeList)
            {
                string imageUrl = node.InnerText;

                if (!_commonUtils.IsValidFileExtension(imageUrl))
                {
                    break;
                }

                WebClient client = new WebClient();
                string downloadString = client.DownloadString(imageUrl);

                imageList.AddRange(_commonUtils.GetImagesInHtmlString(downloadString));

                // Process images in CSS file.
                squishedCssImages.AddRange(ProcessCss(downloadString, imageUrl, ref alreadyProcessed));
            }

            return imageList.Distinct();
        }
开发者ID:deanhume,项目名称:SmushMySite,代码行数:35,代码来源:SmushLogic.cs

示例3: RetrieveAllEntities

        private IEnumerable<Entity> RetrieveAllEntities(DTProject project)
        {
            List<Entity> projectEntities = new List<Entity>();
            projectEntities.Add(project);
            var subEntities = GetSubEntities(project, projectEntities);
            if (subEntities.Count() > 0)
                projectEntities.AddRange(subEntities);

            return projectEntities.Distinct();
        }
开发者ID:pedone,项目名称:DecisionTableAnalizer,代码行数:10,代码来源:ProjectServices.cs


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