C
C#3y ago
Angius

Taking user input and Using .Split() on it

Define "doesn't work"
7 Replies
Angius
AngiusOP3y ago
What's your .NET version? Double-check that Seems like it might be complaining about file-scoped namespaces It's Framework 4.8, yeah It won't support file-scoped namespaces (and most modern features) Is the code you have there, all you have? If so, editing the .csproj file should be enough to update it Close VS, open the .csproj file with Notepad or something, change the target framework version to net7 for example Assuming you use Visual Studio 2022, since 2019 supports only versions up to .NET 5 Weird... Where did you get the screenshot from, then? uh
Angius
AngiusOP3y ago
Code works perfectly fine for me, as-is
Angius
AngiusOP3y ago
Close VS, and open it by double-clicking on the project file? What's that accessibility.dll you speak of? That's where the old .NET Framework that comes with Windows is installed huh Open command prompt or Powershell or something in your project directory, and run dotnet run, see if that works Like in the screenshot I sent
.currence
.currence3y ago
i ma be honest, your defining usertime after the string usertime = console.readline
Angius
AngiusOP3y ago
Nothing of the sort is happening It's usertime, then it's usertimes
.currence
.currence3y ago
oh oh ok very sorry
Angius
AngiusOP3y ago
wtf dotnet --version? No clue what's going on One random guess would be that it's somehow because the project is located on the desktop...? Out of curiosity, still using the CLI, create a project on a different drive and try to run it
mkdir test && dotnet new console && dotnet run
mkdir test && dotnet new console && dotnet run
kinda deal Use a different drive as I said Not the system drive Nice, so it works when on a different drive! Open this project now, and paste your code Nice The error certainly doesn't sound like it was But it might've been, idk Sometimes the issue is some weird system protection on the system drive Or OneDrive indexing the desktop to back it up So, all in all, it's best to have your projects on a non-system drive, and use Github for backups lol

Did you find this page helpful?