Add gen purpose blue row/table utils for data streams
* 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
This commit is contained in:
1 parent
09abe4a432
commit
e24b877e58
8 files changed
+248
-2
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#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];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user