本文整理汇总了C#中ObservableCollection.Except方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.Except方法的具体用法?C# ObservableCollection.Except怎么用?C# ObservableCollection.Except使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.Except方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetResults
public void SetResults(ObservableCollection<CompilationMessage> messages, string windowTitle)
{
Messages = messages;
WindowTitle = windowTitle;
Errors = new ObservableCollection<CompilationMessage>(Messages.Where(m => CompilationMessageHelper.IsLineError(m.Prefix)));
ErrorsHeader = string.Format("Errors ({0})", _errors.Count);
Warnings = new ObservableCollection<CompilationMessage>(Messages.Where(m => CompilationMessageHelper.IsLineWarning(m.Prefix)));
WarningsHeader = string.Format("Warnings ({0})", _warnings.Count);
RawOutput = string.Join("\r\n", Messages.Except(Errors).Except(Warnings).Select(m => m.RawLine));
}
示例2: MembersGetTest
public void MembersGetTest()
{
// Arrange
var personData = new ObservableCollection<IPerson>
{
new Mock<IPerson>().Object,
new Mock<IPerson>().Object,
new Mock<IPerson>().Object
};
IList<IMemberListItemViewModel> membersFieldValue = new List<IMemberListItemViewModel>();
Instance.SetPrivateField(MemberListViewModelMember.MembersField, membersFieldValue);
// Act
var target = new MemberListViewModel(personData);
IList<IMemberListItemViewModel> actualReturn = target.Members;
// Assert
IList<IPerson> actualPeople = actualReturn.Select(vm => vm.Model).ToList();
Assert.True(!personData.Except(actualPeople).Any() && !actualPeople.Except(personData).Any());
}