Skip to content

Commit 2ef63c1

Browse files
linq cleanup
1 parent 4fd42a5 commit 2ef63c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: 1_CS/LINQ/LinqIntro/Program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
void DeferredQuery()
88
{
9-
List<string> names = new() { "Nino", "Alberto", "Juan", "Mike", "Phil" };
9+
List<string> names = ["Nino", "Alberto", "Juan", "Mike", "Phil"];
1010

1111
var namesWithJ = from n in names
12-
where n.StartsWith("J")
12+
where n.StartsWith('J')
1313
orderby n
1414
select n;
1515

@@ -35,7 +35,7 @@ orderby n
3535

3636
void ExtensionMethods()
3737
{
38-
List<Racer> champions = new(Formula1.GetChampions());
38+
List<Racer> champions = [.. Formula1.GetChampions()];
3939
var brazilChampions =
4040
champions.Where(r => r.Country == "Brazil")
4141
.OrderByDescending(r => r.Wins)

0 commit comments

Comments
 (0)