Closed piercebhunt closed 4 years ago
Your homework 02 - 02 C# Iteration - Working with LINQ was marked: Acceptable
“Not Bad” — via Jason L Perry
Pierce, I am going to accept this homework since it does show you are understanding the information. I will challenge you to go back to this assignment in a week or so and see if you can complete it again with the recommendations I make below.
Good work!
You can remove this line here
You can use string interpolation here
var suffixedElement = $"{item} is at index {index}";
See if you can do this one without building a new list.
Nicely done, but can you do this one without building a new list.
Any time we have code like this where it fits the pattern
if (condition)
{
return true;
}
else
{
return false;
}
we can just write
return condition;
So this becomes
public static bool EveryoneIsOdd(List<int> data)
{
return (data.TrueForAll(x => x % 2 != 0));
}
Can you also do this without foreach
Learning programming takes practice and the best practice is repetition. This exercise will allow you time to work on the basics of .NET and how to apply that logic to solving problems.
Objectives
After completing this assignment, you should be able to:
Instructions
git clone https://github.com/YOUR_NAME_HERE/net-iteration
cd net-iteration
dotnet restore
code .
dotnet watch test
Iterations.cs
and work on functions until the test passes. Once you are done with a test you can move to the next one by removing the(Skip = "Remove to run test")
from theFact
attribute. There are a total of 10 questions.Explorer Mode
Additional Resources
Reference the documentation to find what kind of helpful functions might already be in C#.