Separate content and example (#22468)

* Separate content and example

* Fixed formatting
This commit is contained in:
Vocaoson
2018-11-09 16:09:06 +07:00
committed by Manish Giri
parent 18bd15f99f
commit 52b2fd8b91

View File

@ -9,11 +9,13 @@ The `foreach` loop executes a block of code for each item in a collection. The b
### Example ### Example
```csharp ```csharp
// syntax
foreach (element in iterable-item) foreach (element in iterable-item)
{ {
// body of foreach loop // body of foreach loop
} }
// sample code
List<string> Names = new List<string>{ "Jim", "Jane", "Jack" } List<string> Names = new List<string>{ "Jim", "Jane", "Jack" }
foreach(string name in Names) foreach(string name in Names)