Looping

Looping provides the ability to perform a task one or more times until a larger task is complete. This is a reoccurring theme in development. Tasks such as computing the total payroll for a division within a company require looping through each employee's salary information and summing the total value. Rather than hard-coding the necessary statements for N number of employees, a loop can be used to process each employee until all employee salary information has been processed.

C# offers various looping constructs that can be used to perform repetitive tasks. Each has benefits and a time and place for its use. There is no such thing as one-size-fits-all, and this is the reason why there are so many ways to accomplish a particular task. ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.