本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
示例4: Replace
public static string Replace(this string target, ICollection<string> oldValues, string newValue)
{
oldValues.Each(oldValue => target = target.Replace(oldValue, newValue));
return target;
}