Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions csharp-fundamentals-lists.Main/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ public List<string> Question1()

//write code here

_iceCreams.Add("Banana");
_iceCreams.Add("Oreo");

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

_iceCreams.ToList();

throw new NotImplementedException();
}
public List<string> Question3()
Expand All @@ -49,7 +55,7 @@ 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 @@ -65,7 +71,7 @@ public List<string> Question4()
// be sure to include the MoreIceCream and EvenMoreIceCream lists


List<string> results = _iceCreams;
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
// remove exception and write code here
return results;
}
Expand Down
2 changes: 1 addition & 1 deletion csharp-fundamentals-lists.Test/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public CoreTests()
public void Question1()
{

Assert.IsTrue(_core.Question1().Contains("Phish Food", StringComparer.OrdinalIgnoreCase) && _core.Question1().Contains("Peanut Butter Cup", StringComparer.OrdinalIgnoreCase));
Assert.IsTrue(_core.Question1().Contains("Banana", StringComparer.OrdinalIgnoreCase) && _core.Question1().Contains("Oreo", StringComparer.OrdinalIgnoreCase));

}
[Test]
Expand Down
Loading