本文整理汇总了C#中IReadOnlyCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyCollection.Contains方法的具体用法?C# IReadOnlyCollection.Contains怎么用?C# IReadOnlyCollection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReadOnlyCollection
的用法示例。
在下文中一共展示了IReadOnlyCollection.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getSizes
private static IEnumerable<int> getSizes(IReadOnlyCollection<string> args)
{
var numberOfFilesystemArguments = args.Contains(recursive) ? 2 : 1;
var sizes = args.Count == numberOfFilesystemArguments
? defaultSizes
: args.Skip(numberOfFilesystemArguments).Select(a => Convert.ToInt32(a));
return sizes;
}
示例2: TasClientOnFriendListUpdated
private void TasClientOnFriendListUpdated(object sender, IReadOnlyCollection<string> friends)
{
foreach (var battleID in Program.TasClient.ExistingUsers.Values.Where(b => friends.Contains(b.Name) && b.BattleID.HasValue).Select(x=>x.BattleID))
{
var battleIcon = GetBattleIcon(battleID??0);
battleIcon.SetPlayers();
BattleChanged(this, new EventArgs<BattleIcon>(battleIcon));
}
}
示例3: TasClientOnFriendListUpdated
private void TasClientOnFriendListUpdated(object sender, IReadOnlyCollection<string> friends)
{
foreach (var battle in Program.TasClient.ExistingBattles.Values.Where(b => b.Users.Any(y => friends.Contains(y.Key))))
{
var battleIcon = GetBattleIcon(battle.BattleID);
battleIcon.SetPlayers();
BattleChanged(this, new EventArgs<BattleIcon>(battleIcon));
}
}
示例4: Files
/// <summary>
/// The files in a project.
/// </summary>
/// <param name="fileExtensionFilter">Any file extensions to filter out. If empty, all file extensions are returned.</param>
/// <returns></returns>
public IEnumerable<TfsFile> Files(IReadOnlyCollection<string> fileExtensionFilter)
{
var projectDir = Path.GetDirectoryName(ServerPath);
return _projectDocument.Value
.Descendants(XName.Get("Compile", ProjectNamespace)).Concat(_projectDocument.Value
.Descendants(XName.Get("None", ProjectNamespace)))
.Select(e => Path.Combine(projectDir, e.Attribute(XName.Get("Include")).Value))
.Where(p => fileExtensionFilter.Count == 0 || fileExtensionFilter.Contains(Path.GetExtension(p)))
.Select(p => VersionControl.GetItem(p))
.Select(i => new TfsFile(i, VersionControl));
}
示例5: RemoveLines
private void RemoveLines(IReadOnlyCollection<int> indices) {
var visualsToRemove = new List<VisualTextLine>();
foreach (var visual in visuals) {
var line = (VisualTextLine)visual;
if (indices.Contains(line.Index)) {
visualsToRemove.Add(line);
}
}
foreach (var line in visualsToRemove) {
visuals.Remove(line);
}
}
示例6: ByProjectAndCategories
public static FindSpecification<Model.Statistics.FirmCategory3> ByProjectAndCategories(long projectId, IReadOnlyCollection<long?> categoryIds)
{
return new FindSpecification<Model.Statistics.FirmCategory3>(x => x.ProjectId == projectId && categoryIds.Contains(x.CategoryId));
}
示例7: ProjectCategories
public static FindSpecification<ProjectCategory> ProjectCategories(IReadOnlyCollection<long> aggregateIds)
{
return new FindSpecification<ProjectCategory>(x => aggregateIds.Contains(x.ProjectId));
}
示例8: FirmTerritories
public static FindSpecification<FirmTerritory> FirmTerritories(IReadOnlyCollection<long> aggregateIds)
{
return new FindSpecification<FirmTerritory>(x => aggregateIds.Contains(x.FirmId));
}
示例9: ClientContacts
public static FindSpecification<ClientContact> ClientContacts(IReadOnlyCollection<long> aggregateIds)
{
return new FindSpecification<ClientContact>(x => aggregateIds.Contains(x.ClientId));
}
示例10: CompareWrap
private static void CompareWrap(ObservableCollection<string> targetColl, IReadOnlyCollection<string> wcoll, string t1, string t2)
{
Assert.AreEqual(targetColl.Count, wcoll.Count);
Assert.AreEqual(targetColl.Contains(t1), wcoll.Contains(t1));
Assert.AreEqual(targetColl.Contains(t2), wcoll.Contains(t2));
for (int i = 0; i < targetColl.Count; i++)
{
Assert.AreEqual(targetColl[i], wcoll[i]);
}
}
示例11: ModelChildrenCollectionChanged
void ModelChildrenCollectionChanged(IReadOnlyCollection<object> removedItems, IReadOnlyCollection<object> addedItems)
{
if (!IsVisible) {
SwitchBackToLazyLoading();
return;
}
Children.RemoveAll(n => removedItems.Contains(n.Model));
InsertChildren(addedItems);
}
示例12: GetEmailAddressesForUserKeysAsync
public async Task<IDictionary<int, string>> GetEmailAddressesForUserKeysAsync(IReadOnlyCollection<int> distinctUserKeys)
{
var results = await UserRepository.GetAll()
.Where(u => distinctUserKeys.Contains(u.Key))
.Select(u => new { u.Key, u.EmailAddress })
.ToDictionaryAsync(u => u.Key, u => u.EmailAddress);
return results;
}
示例13: AssertRoleListCorrectness
/// <summary>
/// Убедиться в корректности списка ролей пользователя
/// </summary>
/// <param name="roles">Список ролей</param>
/// <exception cref="IncorrectRoleListException">Список ролей некорректен</exception>
private static void AssertRoleListCorrectness(IReadOnlyCollection<string> roles)
{
if (roles.Contains("buildserver") && roles.Count > 1)
{
throw new IncorrectRoleListException();
}
}
示例14: RunAlbumWorkflows
private void RunAlbumWorkflows(
IReadOnlyCollection<IITTrack> tracksToFix,
IReadOnlyCollection<Workflow> albumWorkflows)
{
if (albumWorkflows.Count == 0)
{
return;
}
NewState(0, tracksToFix.Count, "Generating album list...");
var albums = new Dictionary<string,List<IITTrack>>();
foreach (var track in tracksToFix)
{
if (!albums.ContainsKey(track.Album))
{
albums.Add(track.Album, new List<IITTrack> {track});
}
else
{
albums[track.Album].Add(track);
}
ItemsProcessed++;
}
NewState(0, albums.Count, "Running album workflows...");
foreach (var album in albums)
{
// have to set number before count in case old number is higher than count
if (albumWorkflows.Contains(Workflow.FixTrackNumbers))
{
var trackComparer = TrackComparerFactory.GetTrackComparer(album.Value);
album.Value.Sort(trackComparer);
for (var i = 0; i < album.Value.Count; i++)
{
album.Value[i].TrackNumber = i + 1;
}
}
if (albumWorkflows.Contains(Workflow.FixCountOfTracksOnAlbum))
{
foreach (var track in album.Value)
{
track.TrackCount = album.Value.Count;
}
}
ItemsProcessed++;
}
}
示例15: RemoveAuctions
public async Task RemoveAuctions(IReadOnlyCollection<int> ids, string removingUserId, IValidationErrorNotifier errors)
{
var auctions = await mContext.Auctions.Include(x => x.Offers).Where(x => ids.Contains(x.Id)).ToListAsync();
if(!await auctions.All(async x => await CanBeRemoved(x, removingUserId, errors)))
return;
await mContext.Auctions.Where(x => ids.Contains(x.Id)).DeleteAsync();
foreach(var auctionId in ids)
{
RemoveAuctionPhotos(auctionId);
}
}