Class PollPeriodsCollection
Хранит список периодов и предоставляет некоторые функции.
public class PollPeriodsCollection : ICollection<PollPeriod>, IEnumerable<PollPeriod>, IEnumerable
- Inheritance
-
PollPeriodsCollection
- Implements
- Inherited Members
- Extension Methods
Constructors
PollPeriodsCollection(DataStatusPeriod[], PollState)
Конструктор PollPeriodsCollection.
public PollPeriodsCollection(DataStatusPeriod[] periods, PollState pollState)
Parameters
periodsDataStatusPeriod[]pollStatePollStateЭкземпляр класса PollState, к которому относятся периоды.
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
this[int]
Возвращает период по заданному индексу.
public PollPeriod this[int index] { get; }
Parameters
indexint
Property Value
Methods
Add(PollPeriod)
Добавляет период в коллекцию.
public void Add(PollPeriod value)
Parameters
valuePollPeriodЭкземпляр класса PollPeriod.
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(PollPeriod)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(PollPeriod item)
Parameters
itemPollPeriodThe object to locate in the ICollection<T>.
Returns
- bool
true if
itemis found in the ICollection<T>; otherwise, false.
CopyTo(PollPeriod[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(PollPeriod[] array, int arrayIndex)
Parameters
arrayPollPeriod[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<PollPeriod> GetEnumerator()
Returns
- IEnumerator<PollPeriod>
An enumerator that can be used to iterate through the collection.
GetPeriod(int)
Определяет период, которому принадлежит указанная метка времени.
public PollPeriod GetPeriod(int timeMark)
Parameters
timeMarkintМетка времени.
Returns
- PollPeriod
Возвращает период PollPeriod, или null если метка не принадлежит ни одному периоду.
GetPeriodLength(int, out DateTime?, out DateTime?)
Определяет длину периода, которому принадлежит указанная метка времени даже если данного периода не существует (белая полоса).
public int GetPeriodLength(int timeMark, out DateTime? startDate, out DateTime? endDate)
Parameters
timeMarkintМетка времени.
startDateDateTime?Дата начала периода.
endDateDateTime?Дата окончания периода.
Returns
- int
Возвращает длину периода.
GetSummaryLength(DataStatus)
Определяет суммарную длину перодов с указанным статусом данных.
public int GetSummaryLength(DataStatus dataStatus)
Parameters
dataStatusDataStatusСтатус данных.
Returns
- int
Возвращает длину периодов.
IndexOf(PollPeriod)
Возвращает индекс периода в коллекции периодов.
public int IndexOf(PollPeriod value)
Parameters
valuePollPeriod
Returns
Remove(PollPeriod)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(PollPeriod item)
Parameters
itemPollPeriodThe object to remove from the ICollection<T>.
Returns
- bool
true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.