code_junkie

Iterate enumerable object while debugging in Visual Studio

Nov 11th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. this.Page.Validate();
  2. if (!this.Page.IsValid())
  3. {
  4. // breakpoint here
  5. }
  6.  
  7. pages.Where((x) =>
  8. {
  9. if (x.IsValid)
  10. {
  11. Debugger.Break();
  12. return true;
  13. }
  14. return false;
  15. });
  16.  
  17. [Conditional("DEBUG")]
  18. static bool BreakpointPredicate(YourItemType x)
  19. {
  20. if (x.IsValid)
  21. {
  22. Debugger.Break()
  23. return true;
  24. }
  25. return false;
  26. }
  27.  
  28. pages.Where(BreakPointPredicate);
Add Comment
Please, Sign In to add comment