❔ Enumerable.Current is not null in debug mode but assigns null to variable
I know I'm not exactly following the best practices with the reader but this code should work none the less. The debuging shows that the Current property is populated but for some reason still assigns null to _currentModel;
5 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
You:
1. Created an enumerable, stored it in
_commentEnumerable
2. Created a new enumerator from _commentsEnumerable
, called MoveNext()
on it, and then threw it away
3. Created another new enumerator from _commentsEnumerable
, didn't call MoveNext()
on it (so it's still in it's "still at the start" state and Current
is null
4. Are wondering whe the Current
of that second enumerator is null?
I'm not clear on what object you're inspecting there, but surely the issue is that you're creating an enumerator, calling MoveNext, and then throwing it away?Who needs to dispose enumerators right
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.