DateSynchedList
- It can manage its own DateTimes. In this mode, values must be added or inserted together with their corresponding DateTime.
- It can use an externally supplied DateTimes List. In this mode, only values are added or inserted because the DateTimes are already established. Derived classes such as TimeSeriesBase use DateSynchedList to keep data aligned by index with a common DateTime series.
The parameterless constructor creates an instance that manages its own DateTimes. When adding or inserting values, use the overload that also accepts a DateTime. The second constructor associates the instance with the supplied dates List. The DateSynchedList does not manage the DateTimes itself, so values should be added or inserted without supplying DateTimes. The third constructor also associates the instance with dates, and initializes the Values collection with fillValue for each DateTime.
Adds a value to the list and returns its index.
Use Add(T value) when the DateSynchedList is associated with an externally supplied DateTimes List.
Use Add(T value, DateTime dateTime) when the DateSynchedList manages its own DateTimes.
Calling the wrong overload for the current mode throws an InvalidOperationException.
Removes all DateTimes and Values from the DateSynchedList.
Returns the number of DateTimes in the DateSynchedList. DateSynchedList expects the Values collection to remain synchronized with the DateTimes collection.
Contains the DateTimes associated with the Values collection. Assigning this property causes the DateSynchedList to use the supplied DateTimes List instead of managing its own DateTimes.
Returns the final DateTime in DateTimes.
Returns DateTime.MaxValue if the collection is empty.
Clears the Values collection and adds value once for every DateTime in DateTimes. This is useful for initializing a DateSynchedList whose DateTimes have already been established.
Returns the DateTime at idx with its time portion removed. The returned value represents midnight on the same calendar date.
Returns only the time-of-day portion of the DateTime at idx.
Gets or sets the value at idx. If idx is outside the available range, the getter returns DefaultValue and the setter performs no action.
Returns the index corresponding to dt in the DateTimes collection. The DateTimes collection is expected to be sorted in ascending order because the method uses a binary search. If an exact DateTime exists, its index is returned. If exactMatchOnly is false and an exact match does not exist, the method returns the index of the first DateTime following dt. Returns -1 if:
- the collection is empty
- dt occurs before the first DateTime
- dt occurs after the final DateTime
- exactMatchOnly is true and an exact match cannot be found
Inserts a value at idx and returns that index.
Use Insert(int idx, T value) when the DateSynchedList uses an externally supplied DateTimes List.
Use Insert(int idx, T value, DateTime dt) when the DateSynchedList manages its own DateTimes.
Calling the wrong overload for the current mode throws an InvalidOperationException.
Removes the value at idx. When the DateSynchedList manages its own DateTimes, the corresponding DateTime is removed as well. If the Values and DateTimes counts have become different, the corresponding DateTime is also removed in order to restore synchronization. If idx is greater than or equal to Count, the method performs no action.
Removes the time-of-day portion from every DateTime in the DateTimes collection. After calling this method, each DateTime represents midnight on its original calendar date.
Returns the first DateTime in DateTimes.
Returns DateTime.MinValue if the collection is empty.
Returns the amount of time between the first and last DateTimes in the collection. Returns a zero TimeSpan if fewer than two DateTimes are available.
Contains the generic values associated with the DateTimes collection. Each value is expected to correspond by index to the DateTime at the same index.
Returns the value used by the indexer when an invalid index is requested.
The default implementation returns default(T).
Derived classes can override this property to provide a different out-of-range value.