Created
October 10, 2023 16:25
-
-
Save BMU-Verlag/173fe99a62a505387e1f5195c1d11559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
class Program { | |
static void Main() { | |
List<int> zahlen = new List<int> { 1, 2, 3, 4, 5 }; | |
var gefilterteZahlen = from zahl in zahlen | |
where zahl % 2 == 0 | |
select zahl; | |
Console.Write("Gerade Zahlen: "); | |
foreach (var zahl in gefilterteZahlen) { | |
Console.Write(zahl + " "); | |
} | |
// Ausgabe: Gerade Zahlen: 2 4 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment