Foreach Loop

This lesson discusses the foreach loop and its implementation in C#

We'll cover the following

Introduction

The foreach statement is similar to the for statement in that both allow code to iterate over the items of collections, but the foreach statement lacks an iteration index, so it works even with collections that lack indices altogether.

Syntax

It is written in the following form:

Get hands-on with 1200+ tech skills courses.