本文整理汇总了C#中ObservableCollection.SynchronizeWith方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.SynchronizeWith方法的具体用法?C# ObservableCollection.SynchronizeWith怎么用?C# ObservableCollection.SynchronizeWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.SynchronizeWith方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: On_Synchronize_Destination_Has_Corresponding_Items_From_Source
public void On_Synchronize_Destination_Has_Corresponding_Items_From_Source()
{
var source = new ObservableCollection<string>{"1","2","3","4","5"};
var destination = new ObservableCollection<int>();
source.SynchronizeWith(destination);
destination.Should().ContainInOrder(source.Select(int.Parse));
}
示例2: Source_Gets_Destination_Additions
public void Source_Gets_Destination_Additions()
{
var source = new ObservableCollection<string>();
var destination = new ObservableCollection<int>();
source.SynchronizeWith(destination);
destination.Add(100);
destination.Add(200);
source.Should().Contain(destination.Select(x=>x.ToString(CultureInfo.InvariantCulture)));
}
示例3: Destination_Gets_Source_Additions
public void Destination_Gets_Source_Additions()
{
var source = new ObservableCollection<string> { "1", "2", "3", "4", "5" };
var destination = new ObservableCollection<int>();
source.SynchronizeWith(destination);
source.Add("6");
source.Add("7");
destination.Should().ContainInOrder(source.Select(int.Parse));
}