Skip to content

Commit

Permalink
ical v3 PeriodList implements IList<Period> instead of IEnumerable #259
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian Stockbower committed Apr 6, 2017
1 parent df83136 commit f1194f5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
29 changes: 28 additions & 1 deletion net-core/Ical.Net/Ical.Net/DataTypes/PeriodList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Ical.Net.DataTypes
/// <summary>
/// An iCalendar list of recurring dates (or date exclusions)
/// </summary>
public class PeriodList : EncodableDataType, IEnumerable<Period>
public class PeriodList : EncodableDataType, IList<Period>
{
public string TzId { get; set; }
public int Count => Periods.Count;
Expand Down Expand Up @@ -80,5 +80,32 @@ public Period this[int index]
public IEnumerator<Period> GetEnumerator() => Periods.GetEnumerator();

IEnumerator IEnumerable.GetEnumerator() => Periods.GetEnumerator();
public void Clear()
{
Periods.Clear();
}

public bool Contains(Period item) => Periods.Contains(item);

public void CopyTo(Period[] array, int arrayIndex)
{
Periods.CopyTo(array, arrayIndex);
}

public bool Remove(Period item) => Periods.Remove(item);

public bool IsReadOnly => Periods.IsReadOnly;

public int IndexOf(Period item) => Periods.IndexOf(item);

public void Insert(int index, Period item)
{
Periods.Insert(index, item);
}

public void RemoveAt(int index)
{
Periods.RemoveAt(index);
}
}
}
1 change: 0 additions & 1 deletion v2/ical.NET/Interfaces/DataTypes/IPeriodList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public interface IPeriodList : IEncodableDataType, IEnumerable<IPeriod>
IPeriod this[int index] { get; }
void Add(IDateTime dt);
void Add(IPeriod item);
IEnumerator<IPeriod> GetEnumerator();
int Count { get; }
}
}

0 comments on commit f1194f5

Please sign in to comment.