本文整理汇总了C#中ICollection.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# ICollection.CompareTo方法的具体用法?C# ICollection.CompareTo怎么用?C# ICollection.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICollection
的用法示例。
在下文中一共展示了ICollection.CompareTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateOrganizations
private void UpdateOrganizations(ICollection<Organization> original, ICollection<Organization> backup)
{
var organizationsToUpdate = new List<Organization>();
backup.CompareTo(original, EqualityComparer<Organization>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
organizationsToUpdate.Add(x);
break;
case EntryState.Added:
_organizationService.Create(x);
break;
}
});
_organizationService.Update(organizationsToUpdate.ToArray());
}
示例2: UpdateContacts
private void UpdateContacts(ICollection<Contact> original, ICollection<Contact> backup)
{
var contactsToUpdate = new List<Contact>();
backup.CompareTo(original, EqualityComparer<Contact>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
contactsToUpdate.Add(x);
break;
case EntryState.Added:
_contactService.Create(x);
break;
}
});
_contactService.Update(contactsToUpdate.ToArray());
}
示例3: UpdatePricelist
private void UpdatePricelist(ICollection<Pricelist> original, ICollection<Pricelist> backup)
{
var toUpdate = new List<Pricelist>();
backup.CompareTo(original, EqualityComparer<Pricelist>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_pricingService.CreatePricelist(x);
break;
}
});
_pricingService.UpdatePricelists(toUpdate.ToArray());
}
示例4: UpdateStores
private void UpdateStores(ICollection<Store> original, ICollection<Store> backup)
{
var toUpdate = new List<Store>();
backup.CompareTo(original, EqualityComparer<Store>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_storeService.Create(x);
break;
}
});
_storeService.Update(toUpdate.ToArray());
}
示例5: UpdateOrders
private void UpdateOrders(ICollection<CustomerOrder> original, ICollection<CustomerOrder> backup)
{
var toUpdate = new List<CustomerOrder>();
backup.CompareTo(original, EqualityComparer<Operation>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_customerOrderService.Create(x);
break;
}
});
_customerOrderService.Update(toUpdate.ToArray());
}
示例6: UpdateCatalogProducts
private void UpdateCatalogProducts(ICollection<CatalogProduct> original, ICollection<CatalogProduct> backup)
{
var toUpdate = new List<CatalogProduct>();
backup.CompareTo(original, EqualityComparer<CatalogProduct>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_itemService.Create(x);
break;
}
});
_itemService.Update(toUpdate.ToArray());
}
示例7: UpdateCoupons
private void UpdateCoupons(ICollection<Coupon> original, ICollection<Coupon> backup)
{
var toUpdate = new List<Coupon>();
backup.CompareTo(original, EqualityComparer<Coupon>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_promotionService.CreateCoupon(x);
break;
}
});
_promotionService.UpdateCoupons(toUpdate.ToArray());
}
示例8: UpdateContentFolders
private void UpdateContentFolders(ICollection<DynamicContentFolder> original, ICollection<DynamicContentFolder> backup)
{
backup.CompareTo(original, EqualityComparer<DynamicContentFolder>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
_dynamicContentService.UpdateFolder(x);
break;
case EntryState.Added:
_dynamicContentService.CreateFolder(x);
break;
}
});
}
示例9: UpdateContentPublications
private void UpdateContentPublications(ICollection<DynamicContentPublication> original, ICollection<DynamicContentPublication> backup)
{
var toUpdate = new List<DynamicContentPublication>();
backup.CompareTo(original, EqualityComparer<DynamicContentPublication>.Default, (state, x, y) =>
{
switch (state)
{
case EntryState.Modified:
toUpdate.Add(x);
break;
case EntryState.Added:
_dynamicContentService.CreatePublication(x);
break;
}
});
_dynamicContentService.UpdatePublications(toUpdate.ToArray());
}