Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
kristbsy committed Jan 8, 2025
1 parent a0739af commit 0927e3b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions csharp-fundamentals-lists.Main/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ public List<string> Question1()
// declares a List<string> which is a collection of strings.
// by typing _iceCreams. intellisense shows all of the methods associated with the _inceCreams list.
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"

_iceCreams.AddRange(["Phish Food", "Peanut Butter Cup"]);
//write code here

return _iceCreams;
}

public int Question2()
{

//TODO: find the lists method that returns the number of ice creams in the list and return this.

// remove exception and write code here
throw new NotImplementedException();
return _iceCreams.Count();
}
public List<string> Question3()
{

// The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list.
//TODO: you can 'chain' methods on the _iceCream list, so add another Concat to include EvenMoreIceCream (this is defined below) to the result list . e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).ToList()

List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList();

return results;

Expand All @@ -64,6 +64,7 @@ public List<string> Question4()
// copy the List declaration line from Question3 and add the .Distinct() into the chain. e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).Distinct().ToList()
// be sure to include the MoreIceCream and EvenMoreIceCream lists

return _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();

List<string> results = _iceCreams;

Check warning on line 69 in csharp-fundamentals-lists.Main/Core.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected

Check warning on line 69 in csharp-fundamentals-lists.Main/Core.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected
// remove exception and write code here
Expand Down

0 comments on commit 0927e3b

Please sign in to comment.