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


C# ICollection.Each方法代码示例

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


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

示例1: UnAssignRoles

        public static void UnAssignRoles(this IAuthRepository UserAuthRepo, IUserAuth userAuth,
            ICollection<string> roles = null, ICollection<string> permissions = null)
        {
            var managesRoles = UserAuthRepo as IManageRoles;
            if (managesRoles != null)
            {
                managesRoles.UnAssignRoles(userAuth.Id.ToString(), roles, permissions);
            }
            else
            {
                roles.Each(x => userAuth.Roles.Remove(x));
                permissions.Each(x => userAuth.Permissions.Remove(x));

                if (roles != null || permissions != null)
                {
                    UserAuthRepo.SaveUserAuth(userAuth);
                }
            }
        }
开发者ID:AVee,项目名称:ServiceStack,代码行数:19,代码来源:UserAuthRepositoryExtensions.cs

示例2: ConfigureColumnNames

        private static void ConfigureColumnNames(
            ICollection<string> keyColumnNames, IList<StorageScalarPropertyMapping> propertyMappings)
        {
            DebugCheck.NotNull(keyColumnNames);
            DebugCheck.NotNull(propertyMappings);

            if ((keyColumnNames.Count > 0)
                && (keyColumnNames.Count != propertyMappings.Count))
            {
                throw Error.IncorrectColumnCount(string.Join(", ", keyColumnNames));
            }

            keyColumnNames.Each((n, i) => propertyMappings[i].ColumnProperty.Name = n);
        }
开发者ID:hallco978,项目名称:entityframework,代码行数:14,代码来源:ManyToManyAssociationMappingConfiguration.cs

示例3: ConfigureColumnNames

        private static void ConfigureColumnNames(
            ICollection<string> keyColumnNames, IList<DbEdmPropertyMapping> propertyMappings)
        {
            Contract.Requires(keyColumnNames != null);
            Contract.Requires(propertyMappings != null);

            if ((keyColumnNames.Count > 0)
                && (keyColumnNames.Count != propertyMappings.Count))
            {
                throw Error.IncorrectColumnCount(string.Join(", ", keyColumnNames));
            }

            keyColumnNames.Each((n, i) => propertyMappings[i].Column.Name = n);
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:14,代码来源:ManyToManyAssociationMappingConfiguration.cs

示例4: Replace

 public static string Replace(this string target, ICollection<string> oldValues, string newValue)
 {
     oldValues.Each(oldValue => target = target.Replace(oldValue, newValue));
     return target;
 }
开发者ID:gowhy,项目名称:MicroWish,代码行数:5,代码来源:StringExtensions.cs


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