本文整理汇总了C#中TrackingCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TrackingCollection.Add方法的具体用法?C# TrackingCollection.Add怎么用?C# TrackingCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackingCollection
的用法示例。
在下文中一共展示了TrackingCollection.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_not_raise_event_once_handler_detached
public void Should_not_raise_event_once_handler_detached() {
var addedItems = new List<string>();
var items = new TrackingCollection<string>();
using(items.OnItemAdded(addedItems.Add)) {
items.Add("foo");
}
items.Add("bar");
addedItems.Count.ShouldEqual(1);
}
示例2: When_Item_Added_Raises_ItemAdded
public void When_Item_Added_Raises_ItemAdded() {
string addedItem = null;
var items = new TrackingCollection<string>();
using(items.OnItemAdded(x => addedItem = x)) {
items.Add("foo");
}
addedItem.ShouldEqual("foo");
}
示例3: AddingItemsToCollectionManuallyThrows
public void AddingItemsToCollectionManuallyThrows()
{
var col = new TrackingCollection<Thing>(Observable.Empty<Thing>());
Assert.Throws<InvalidOperationException>(() => col.Add(GetThing(1)));
col.Dispose();
}
示例4: GetTrackingsFor
internal TrackingCollection GetTrackingsFor(string entryId, DataManager data)
{
Load(data);
TrackingCollection filtered = new TrackingCollection();
foreach (Tracking c in Trackings)
{
if (c.TargetEntryId.ToUpper() == entryId.ToUpper())
{
filtered.Add(c);
}
}
return filtered;
}
示例5: TrackingCollection
TrackingCollection IBlogDataService.GetTrackingsFor(string entryId)
{
TrackingCollection trackingsForEntry = new TrackingCollection();
DateTime date = GetDateForEntry(entryId);
if (date == DateTime.MinValue)
return trackingsForEntry;
DayExtra extra = data.GetDayExtra(date);
foreach (Tracking trk in extra.Trackings)
{
if (trk.TargetEntryId.ToUpper() == entryId.ToUpper())
{
trackingsForEntry.Add(trk);
}
}
return trackingsForEntry;
}
示例6: Add_AddsItem
public void Add_AddsItem() {
var items = new TrackingCollection<string>();
items.Add("foo");
items.Single().ShouldEqual("foo");
}