本文整理汇总了C#中IReadOnlyCollection.Except方法的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyCollection.Except方法的具体用法?C# IReadOnlyCollection.Except怎么用?C# IReadOnlyCollection.Except使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReadOnlyCollection
的用法示例。
在下文中一共展示了IReadOnlyCollection.Except方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveOwnedSourceItemsAsync
public Task<IReadOnlyCollection<IProjectSourceItem>> RemoveOwnedSourceItemsAsync(
IReadOnlyCollection<IProjectSourceItem> projectItems, DeleteOptions deleteOptions) {
var projectDirectory = _unconfiguredProject.GetProjectDirectory();
List<IProjectSourceItem> itemsInProjectFolder = projectItems
.Where(item => !PathHelper.IsOutsideProjectDirectory(projectDirectory, item.EvaluatedIncludeAsFullPath))
.ToList();
return
Task.FromResult(itemsInProjectFolder.Count == 0
? projectItems
: projectItems.Except(itemsInProjectFolder).ToImmutableArray());
}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:12,代码来源:FileSystemMirroringProjectSourceItemProviderExtensionBase.cs
示例2: FilteredPostVault
public FilteredPostVault(IReadOnlyCollection<PostViewModel> posts)
{
var now = DateTime.UtcNow;
var timezone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
AllPosts = posts;
ActivePosts =
AllPosts
.OrderByDescending(x => x.PublishedAtCst)
.Where(x => now >= TimeZoneInfo.ConvertTimeToUtc(x.PublishedAtCst, timezone))
.ToList();
FuturePosts = AllPosts.Except(ActivePosts).ToList();
}
示例3: TryFindMostDerivedType
internal static bool TryFindMostDerivedType(IReadOnlyCollection<Type> customBootstrappers, out Type bootstrapper)
{
var set = new HashSet<Type>();
bootstrapper = null;
if (customBootstrappers.All(b => set.Add(b.BaseType)))
{
var except = customBootstrappers.Except(set).ToList();
bootstrapper = except.Count == 1 ? except[0] : null;
}
return bootstrapper != null;
}
示例4: OrderList
private static CompletionList OrderList(IReadOnlyCollection<Completion> completions) {
// Place 'name =' at the top prioritizing argument names
// Place items starting with non-alpha characters like .Call and &&
// at the end of the list.
var argumentNames = completions.Where(x => RTokenizer.IsIdentifierCharacter(x.DisplayText[0]) && x.DisplayText.EndsWith("=", StringComparison.Ordinal));
var rtvsNames = completions.Where(x => x.DisplayText.IndexOfIgnoreCase(".rtvs") >= 0);
var specialNames = completions.Where(x => !char.IsLetter(x.DisplayText[0]));
specialNames = specialNames.Except(rtvsNames);
var generalEntries = completions.Except(argumentNames);
generalEntries = generalEntries.Except(rtvsNames);
generalEntries = generalEntries.Except(specialNames);
List<Completion> orderedCompletions = new List<Completion>();
orderedCompletions.AddRange(argumentNames);
orderedCompletions.AddRange(generalEntries);
orderedCompletions.AddRange(specialNames);
return new CompletionList(orderedCompletions);
}
示例5: TestCompare
private void TestCompare(IReadOnlyCollection<string> expectedActions, string prefix = null)
{
var writer = new MockTopologyWriter();
var comparator = new TopologyComparator(new LoggerConfiguration().CreateLogger(), writer)
{
AllowDelete = true,
AllowRecreate = true,
AllowUnbind = true
};
comparator.Compare(
existingTopology.FilterByNamespace(prefix),
definedTopology);
var hasUnexpectedActions = false;
var results = new StringBuilder();
results.AppendLine("Expected actions not executed:");
foreach (var line in expectedActions.Except(writer.Actions))
{
results.AppendLine(" " + line);
hasUnexpectedActions = true;
}
results.AppendLine("Executed action not expected:");
foreach (var line in writer.Actions.Except(expectedActions))
{
results.AppendLine(" " + line);
hasUnexpectedActions = true;
}
if (hasUnexpectedActions)
{
results.AppendLine("Full log:");
foreach (var line in writer.Actions)
results.AppendLine(" " + line);
Assert.Fail(results.ToString());
}
}