break out of loop
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: Collections
Tags: C# Collections
var data = new[] { 1, 2, 3, 4, 5 }; // works also for 'while' and 'for' foreach (int i in data) { if (i == 3) break; // breaks out of loop }
| Send us feedback about this snippet » |





