C
C#3y ago
Mastalt

❔ IEnumerable is empty for some reason

I want to add a filter to check if an IEnumerable is empty so i'm using IEnumerable.Any(), but my IEnumerable afterward is empty and i can't do anything with it. If i remove the check, the data is suddenly there.
2 Replies
Mastalt
MastaltOP3y ago
c#
using TextReader reader = new StreamReader(files);
BoatDataParser parser = new BoatDataParser();

IEnumerable<BoatData> dailyData = parser.ParseCSVFile(reader).removePyrOverload().checkforUncatchedPyr().dataJumpChecker();

if (checkForEmpty(dailyData))
c#
using TextReader reader = new StreamReader(files);
BoatDataParser parser = new BoatDataParser();

IEnumerable<BoatData> dailyData = parser.ParseCSVFile(reader).removePyrOverload().checkforUncatchedPyr().dataJumpChecker();

if (checkForEmpty(dailyData))
oh i created a mothod here but dailyData.Any() does the same Filter out some unwanted datas, they all work fine, i've tested them numerous time without the if statment The thing is, All of the methods work fine, without the if statment that is, as soon as i pout the if there tho, the data in dailyData suddenly vanishs
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?