using System; using System.Threading; namespace MyFirstProgram { class Program { static void Main(string[] args) { // thread = an execution path of a program // We can use multiple threads to perform, // different tasks of our program at the same time. // Current thread running is "main" thread // using System.Threading; Thread mainThread = Thread.CurrentThread; mainThread.Name = "Main Thread"; //Console.WriteLine(mainThread.Name); Thread thread1 = new Thread(() => CountDown("Timer #1")); Thread thread2 = new Thread(() => CountUp("Timer #2")); thread1.Start(); thread2.Start(); Console.WriteLine(mainThread.Name + " is complete!"); Console.ReadKey(); } public static void CountDown(String name) { for (int i = 10; i >= 0; i--) { Console.WriteLine("Timer #1 : " + i + " seconds"); Thread.Sleep(1000); } Console.WriteLine("Timer #1 is complete!"); } public static void CountUp(String name) { for (int i = 0; i
Hi! Could you make a video about topic "How to handle 2 keys pressed simultaneously in java"? Please... I'm Vietnamese and I'm really looking forward to this
Welcome adventurer! Seems like you've had a long way to get here (if you didn't skip any tutorial). Relax and be happy, because you just learned how to program in C# from the best teacher ever. Seems like I have to go! I wish you luck on your next programming adventure.
Since I got to know this channel, it has become my favorite channel when looking for comprehensive but concise and easy to understand programming courses! Great channel. Great content. Great teaching style. Very concise and precise and straight to the point! Thanks a lot for helping people learn to program :)
Thank you so much. I was trying to wrap my head around multithreading as used in Sebastian Lague’s procedurally generated terrain tutorial and this helped me a ton to understand what was going on.
3:35 that makes a lot of sense now! Basically, running code on the same thread means your program will execute the code from top to bottom, and only execute the bottom after finishing to top. Multithreading enables you to run two different programs/commands (like you said) at the same time without having to wait for each other
Completed all 50 videos. Thank you so much for the course. Your explanation and examples was very easy to understand. Thank you for all the amazing videos.
Bro Code! So great this video. It goes straight to the point, in a very simple manner and explains clearly the difference between with and without multithreading. Thumbs up!
Bro Code, ma bro. You've been cranking videos! I'm very happy for you and the other people who're gonna learn from you. I hope you got 8 hours of sleep though...
I know it's been 6 months, but in case you haven't discovered it yet, you can use the DateTime type to compare a stored time value with the current time.
Could you enlighten me about what happens with the main thread? What should I do with it? Should one of the timers run on it, or is it better to create a new thread for every timer? Additionally, where should Tasks be used, or are they not relevant? I used your video's examples to understand threads more clearly.
Just subscribed. Two really great vids on topics I've been literally scouring the net for weeks. Just a fluke I've come across Bro Code. Keep up the excellent work!
excuse me, how i can firstly do thread1 and thread2, and after that main thread? because the code is working like: "Main thred completed. Thread1 and thread2 are starting"
Thank yuo Bro, is it in your plans making a video about Lambdas in c#? Also where did you learn about tasks not being able to call for methods with parameters? It cost me a real deal to know about this online...
When you First typed out the multi thread function windows updates started to run and I saw on my monitor two of the threads spin up and I had to pause the video because I was laughing too much
using System;
using System.Threading;
namespace MyFirstProgram
{
class Program
{
static void Main(string[] args)
{
// thread = an execution path of a program
// We can use multiple threads to perform,
// different tasks of our program at the same time.
// Current thread running is "main" thread
// using System.Threading;
Thread mainThread = Thread.CurrentThread;
mainThread.Name = "Main Thread";
//Console.WriteLine(mainThread.Name);
Thread thread1 = new Thread(() => CountDown("Timer #1"));
Thread thread2 = new Thread(() => CountUp("Timer #2"));
thread1.Start();
thread2.Start();
Console.WriteLine(mainThread.Name + " is complete!");
Console.ReadKey();
}
public static void CountDown(String name)
{
for (int i = 10; i >= 0; i--)
{
Console.WriteLine("Timer #1 : " + i + " seconds");
Thread.Sleep(1000);
}
Console.WriteLine("Timer #1 is complete!");
}
public static void CountUp(String name)
{
for (int i = 0; i
Why are you uploading videos like this? Why don't make it a full course.
Hi! Could you make a video about topic "How to handle 2 keys pressed simultaneously in java"? Please... I'm Vietnamese and I'm really looking forward to this
@@agoogleuser3402 already
Beat YT alg !
Thank u❤
Wow. This is clear, short and so easy to understand. No obnoxious music, just plain code and explanations. Thank you!
I only can say: WOW, YOU EXPLANATION SKILL IS SECRET LEVEL!!! Thank you for your knowledge sharing.
Thank you for explaining this in a simple way, it's not easy to find this kind of stuff nowadays!
Welcome adventurer! Seems like you've had a long way to get here (if you didn't skip any tutorial). Relax and be happy, because you just learned how to program in C# from the best teacher ever.
Seems like I have to go! I wish you luck on your next programming adventure.
first time I ran into your channel, you explainned in 6 min what my lecturer couldn't in 2 hours! you got a new subscriber, thank you
Bro i like your style of explaining, no BS talking ,straight to the point
Since I got to know this channel, it has become my favorite channel when looking for comprehensive but concise and easy to understand programming courses!
Great channel. Great content. Great teaching style. Very concise and precise and straight to the point!
Thanks a lot for helping people learn to program :)
he also finished all the courses not like stopping after uploading a few videos like other youtuebers
Thank you so much. I was trying to wrap my head around multithreading as used in Sebastian Lague’s procedurally generated terrain tutorial and this helped me a ton to understand what was going on.
WOW, this is the easiest example of Multi Threading I have seen online to date. Thank you this makes it so much easier to understand!
So easily explained, before this I thought of multithreading some tough concept but now the way you explained I will remember lifetime.
Thank you...
Bro you should really continue this channel. Your explanation is sooo good. C# videos of such quality are hard to find on youtube
3:35 that makes a lot of sense now! Basically, running code on the same thread means your program will execute the code from top to bottom, and only execute the bottom after finishing to top. Multithreading enables you to run two different programs/commands (like you said) at the same time without having to wait for each other
Completed all 50 videos. Thank you so much for the course. Your explanation and examples was very easy to understand. Thank you for all the amazing videos.
Hey Bro, keep up the good work. These 50 C# videos helped me a lot to get a grip on the language. Thank you so much!
Your style of teaching is concise and clear. Wish you would also do more advanced c# topics and tutorials. I learned a lot from this. Thank you.
Bro Code! So great this video. It goes straight to the point, in a very simple manner and explains clearly the difference between with and without multithreading. Thumbs up!
Oh nice, 50 new videos! Thanks for all of the effort put into these videos
my man just spammed the upload button dayummmm .. now i have videos to binge all night
OMG thank you, I've been trying to learn that async sh*t, but that wasn't what I was looking for. This was extremely, INSANELY, simple.
Thank you for explaining it very well. Was pulling hair all day to get a grasp about this topic.
just learned C# thanks to you. A great journey is ahead!
Bro Code, ma bro. You've been cranking videos! I'm very happy for you and the other people who're gonna learn from you. I hope you got 8 hours of sleep though...
im freaking love your series, i have watched c++ and c# now and i can say that i surely can start programming now!
thank you bro :D
This video made me learn in 6 minutes what my programming teacher made me learn in 2 weeks
Just finished each one of his courses, so amazing!
Simple and clear lessons.
Verry good!
Thanks.
Thank you for this Bro! You are very clear and direct to the point, which makes the topics easy to understand
Yo that's some slick explaining you did there ... thanks got the basic concept down thanks to you
Thank you very much. You helped me a lot with my project. I was needing a timer, running on the "background" and your tutorial helped me a lot! :)
I know it's been 6 months, but in case you haven't discovered it yet, you can use the DateTime type to compare a stored time value with the current time.
Could you enlighten me about what happens with the main thread?
What should I do with it? Should one of the timers run on it, or is it better to create a new thread for every timer?
Additionally, where should Tasks be used, or are they not relevant?
I used your video's examples to understand threads more clearly.
OMG, clicking through all the indian videos till I finally find a proper english video about this topic...
Thank you for your nice and clear explanation!!!
Just subscribed. Two really great vids on topics I've been literally scouring the net for weeks. Just a fluke I've come across Bro Code. Keep up the excellent work!
Thank you so much, your tutorial help me to learn a lot of new things!
U ARE SO UNDERRATED FFS
Thank you so much for explaining it so simple and easy to understand!
Can you do Lambda Expressions also?
Thank you! You're very good at explaining.
Very nice! I 'm checking all other material in this channel. Thanks!
You helped me a lot.. the best tutorial out there.. thanksss
Great work and it would be very much helpful if you could give an real time examples like were this could be used in an automation frame work or so.
Amazing! Please upload more C# Tutorials about real projects.
If you ever feel lonely, remember we're your here for you, bro!
Great video, thank you for explaining this in a simple way. Keep it on!
I wish you made more c# tutorials on LinQ stuff and IEnumerables, etc.
Thanks for sharing! Greetings from Brazil!
Very Simple way of explaining.
Easy, fast and importantly clear 👍😎
man, you are the best. Thank you for this tutorial😘
many thanks, I like your english - much better as my
really appreciating this channel. keep it nice and simple for us my bro.
My english it's not good, but i can understand everything what you say. I want to see a video about Lambda expression. Thank you for yours videos.
Clear, simple, to the point. thanks!
jesus christ my abo box, good stuff.
Very well explained. Thanks Bro 🙂. A video on C# lambda would be useful as I didn't understand the bit about () => Thread1("thread #1").
Thank you for the easy and quick lesson! :D
Liked, Subscribed, and Commented. You've earned it. You're great.
Your videos are great! Many others could not help me, and despite the foreign language, I understood you perfectly
please add more tutorials. async await would be great for next topic !
Great explanation in a nutshell 👏👏
I am glad to see you again!
yo you uploaded a lot of videos!
Thanks for this concise run through! :)
Great, very helpful, thanks for sharing...
Thanks for the tutorial! It was nice and easy to understand!
Short but crucial... A nice video
I wish you had more videos on C#
excuse me, how i can firstly do thread1 and thread2, and after that main thread? because the code is working like: "Main thred completed. Thread1 and thread2 are starting"
I think, it is because separate threads are created than Main thread, so we have three threads thread1, thread 2, Main thread
Awesome! Saved me hours of study!
To the point. Easy, peasy.
Absolutely fantastic.. Thank you!
Thanks for all these videos they ar so helpful
very nice and simple way to make me clear : thanks Bro
Amo tus videos Bro!!! Espero puedas subir mas!!! Un abrazo desde Perú
These were great. I speedran through the playlist at 1.75x in about 2-3 days or so.
5:46 A video on lambda expressions would be great, yeah.
I would love to see a video about the Lambda expressions too!
Can you make a tutorial for Windows form snake game with C#? I would like to see more C# project tutorials.
thanks for the 50 tutorial.
Nice example
Thank you for this video, I am commenting to boost the algorithm and help your channel cuz im so cool like that fr fr. But thanks :D
Nice explanation
Thank you bro! At 5:00 it was what I was loking about. Thanks
nice vedio.
fantastic video series, thank you so much for your work!!!
Thank you! This short clip helped alot!
As always, excellent. thank you, Bro
You are amazing. I really like your videos 👍🏻
Great videos make some some more advance c# tutorials please
Awesome work here.
it was good task. Congrulations Bro!
Awesome tutorial for beginners!
Amazing tutorial
Thank yuo Bro, is it in your plans making a video about Lambdas in c#?
Also where did you learn about tasks not being able to call for methods with parameters? It cost me a real deal to know about this online...
Clear and simple. Thanks alot!
My bro is fastest growing coding channel
Nothing compares to you, Bro.
Thank you for these!
Briliant tutorial, thank you!
I feel like there's gonna be a C# full course in the future!
Bro is this course to learn c# from basic to full or are there some topics missing
@@ishaanbhardwaj6121 Long story short, this video gives more topics that a paid course on Udemy
Simple and clear. Ty bro!
When you First typed out the multi thread function windows updates started to run and I saw on my monitor two of the threads spin up and I had to pause the video because I was laughing too much
Good video!!! What about starting and stopping threads??