> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baenninger.me/llms.txt
> Use this file to discover all available pages before exploring further.

# foreach-Loops

Mit dem `foreach`-Loop können wir über [Collections](/dotnet/c/collections/arrays) iterieren.

<Tabs>
  <Tab title="Syntax">
    ```csharp theme={null}
    foreach (type variable in collection) 
    {
        ..
    }
    ```
  </Tab>

  <Tab title="Beispiel">
    ```csharp theme={null}
    string[] cars = { "Volvo", "BMW", "Ford", "Mazda" };
    foreach (string car in cars) 
    {
      Console.WriteLine(car);
    }
    ```
  </Tab>

  <Tab title="Output">
    ```text theme={null}
    Volvo
    BMW
    Ford
    Mazda
    ```
  </Tab>
</Tabs>
