C
C#4mo ago
Eguzki

System.Linq and TakeLast() not defined.

Hi. I am going through the book Head First C# and in chapter 9 when they introduce LINQ I am getting a weird error. I tried to google my problem but I couldn't find a solution. The book has me calling the method TakeLast() on a list. However Visual Studio is telling me that method is not defined. All I could find on the internet is to make sure I am using System.Linq. Which I am. I made sure my project properties is using the latest version of C#. I am really lost about this. Was TakeLast() removed ?
No description
7 Replies
Jimmacle
Jimmacle4mo ago
i think it's the opposite problem, you're using an older version of .NET that doesn't have it make sure you're using .NET 8 if you're using anything that says .NET Framework that's old and should be avoided
Eguzki
EguzkiOP4mo ago
Ok Thank you very much that is the problem. I am using .NET Framework 4.7.2.... I will install the new version. 🙏🙏🙏
The Fog from Human Resources
:SCshocked: 4.7.2 is beyond old
Eguzki
EguzkiOP4mo ago
Yup I created the project using .NET Framework console App template without realizing. It defaulted to that version
Angius
Angius4mo ago
$newproject
MODiX
MODiX4mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Angius
Angius4mo ago
For future reference
Want results from more Discord servers?
Add your server