✅ I'm trying to work with Timer class but something doesn't work properly..
I'm following "Bob Tabor" course in Microsoft channel. I'm following him step by step, but it seems like what works for him doesn't work anymore, maybe C# update took a part in the past?
It doesn't detect the Timer object in line 11 for some reason, what is wrong?
Bob Tabor did it exactly this way.
Around 07:20:00 in this video:
https://www.youtube.com/watch?v=0QUgvfuKvWU&t=25421s
Microsoft Developer
YouTube
C# Fundamentals for Beginners
Check out the new Foundational C# Certification by freeCodeCamp: https://aka.ms/csharp-certification
Classic Throwback Series with Bob Tabor | Originally published in 2019
Install the latest version of Visual Studio at https://visualstudio.microsoft.com/?WT_mc_id=dotnet-58793-cxa and follow along at home too.
C# is a powerful and widely used p...
31 Replies
if you hover with the mouse over timer does it say ambigous reference?
or when you try to compile what are the errors?
yep
as the message says timer exists in system.timers and system.threading..
remove one of the namespace imports
since threading seems unused i would guess that one
And if I used both?
How can I avoid it?
And thank you very much\
you would have to either create a alias or be more specific when using
eg instead of Timer you would have to write system.threading.timer
Still have the same issue after deleting the threading
is it in global usings?
what do you mean "global using"?
to not always have to import the same namespaces there are global usings that you define just once and have access to in the whole project
aa so yes ofcourse
I wrote on the top:
using System.Timers;
naah thats not what i mean ;) gimme a sec
Oh okie
Sorry 🙏
rightclick the project then properties then in the settings on the left side there should be a tab globals usings. is that setting on or off?
or alternatively open the csproj in a texteditor and search for ImplicitUsings
That's what I have
aa wait on the class
I guess i found this global, 1 sec
seems like on?
yeah turn it off
for new devs thats always a trap -.-
Thank you!
May I know what exactly it does please?
Because it sees like Console.ReadLine() doesn't work now?
like i wrote before these using are globally available, so you dont have to add these using yourself in every class, but like in your case can clash with other namespaces that you define locally.
for console.writeline just add
using System; at the top of the file
already have 😶
aehm did you rebuild the project?
seems to me like you were making changes to the code while debugging
Yeah but not now, I did it few hours ago
try now.. does it give any errors?
To try to do "Rebuild" you mean?
jea
yep helped!! thank you much much ❤️
Other problems appeared but this works at least 😂
when you dont understand why visual studio is adding squigglies under something, always hover over it first and see what VS has to say.. it would have told you ;)
Oh yeah, but it's really confusing
Too many words I'm not sure about
I believe I will get better with time.
Just want to tell you thank you very much, you helped tons, and as it seems, everything works properly ❤️
np