* Add BlueRowReflection<T> so ViewStream implementations can use strong row types without needing to implement IBlueRow * Add default implementations for IDictionary members in IBlueRow to make implementing IBlueRow less tedious
33 lines
728 B
C#
33 lines
728 B
C#
#nullable enable
|
|
namespace BCG;
|
|
|
|
using System;
|
|
using System.Collections;
|
|
|
|
public class BlueRowValueCollection : ICollection {
|
|
readonly IBlueRow row;
|
|
|
|
public BlueRowValueCollection(IBlueRow row) =>
|
|
this.row = row;
|
|
|
|
public int Count => row.schema.columnInfo.Length;
|
|
|
|
public bool IsSynchronized => false;
|
|
|
|
public object SyncRoot => this;
|
|
|
|
public void CopyTo(Array array, int index) {
|
|
var length = row.schema.columnInfo.Length;
|
|
for (int i = 0; i < length; i++) {
|
|
array.SetValue(row[i], i + index);
|
|
}
|
|
}
|
|
|
|
public IEnumerator GetEnumerator() {
|
|
var length = row.schema.columnInfo.Length;
|
|
for (int i = 0; i < length; i++) {
|
|
yield return row[i];
|
|
}
|
|
}
|
|
}
|