You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there. I am having problems with the memory efficiency of the GetDynamicRecords() method, as it seems to read the entire file at once. This doesn't work well for large files.
Currently I am essentially having to store each record twice. A processed version as part of my program, and once as the IReadOnlyList because it survives for as long as the IEnumerable does. See code below
public IEnumerable<IDictionary<string, object>> Records { get { RestartStream(); IReadOnlyList<dynamic> records = csv.GetDynamicRecords(); foreach (var rec in records) { yield return ((IDictionary<string, object>)rec); } } }
It works this way to allow it to interface with the rest of the program, as each rec has to be carefully processed and stored for later use
Could we have an option to return this as something like an IEnumerable where the underlying stream is only read as its needed? Or even if we could read the dynamic records one at a time that would help
EDIT: Sorry I realised this actually already exists, it just wasn't listed in the examples. The function I wanted was EnumerateDynamicRecords()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there. I am having problems with the memory efficiency of the GetDynamicRecords() method, as it seems to read the entire file at once. This doesn't work well for large files.
Currently I am essentially having to store each record twice. A processed version as part of my program, and once as the IReadOnlyList because it survives for as long as the IEnumerable does. See code below
public IEnumerable<IDictionary<string, object>> Records { get { RestartStream(); IReadOnlyList<dynamic> records = csv.GetDynamicRecords(); foreach (var rec in records) { yield return ((IDictionary<string, object>)rec); } } }
It works this way to allow it to interface with the rest of the program, as each rec has to be carefully processed and stored for later use
Could we have an option to return this as something like an IEnumerable where the underlying stream is only read as its needed? Or even if we could read the dynamic records one at a time that would help
EDIT: Sorry I realised this actually already exists, it just wasn't listed in the examples. The function I wanted was EnumerateDynamicRecords()
Beta Was this translation helpful? Give feedback.
All reactions