The crash course provided here is of high quality and designed to be easily understandable for individuals transitioning from a different programming language. It effectively assists in building comfort with the syntax. Your next focus should be on grasping the OOP programming concept and understanding the .net framework, Visual Studio, and Git. By doing so, you are well on your way to becoming a skilled programmer.
I'm a Mid Python Developer who is have a C# Interview and task. This is my first-time writing C#, but I swear it's one of the best tutorials i have ever seen. Keep going man.
Thanks for the video it's a real crash course. Best part is not specifying the highlight the most used feature. The video content is describing all the topic with equal priority. Love from Bangladesh 🐅
Amazing video! Could you do a video on creating NinjaTrader indicators and/or strategies as they use the C# langueage too. Maybe even delve into creating add-ons for their software.
Thank you for this nice tutorial. Could you make a tutorial to cover the methods for beginners.(creating methods, calling methods, returning type and none returning types and etc.)
Hmmm...seems to be working for me. You can try creating a brand new Visual Studio solution from scratch, and just copy or re-write the code. If that still doesn't work, you might have a corrupted VS installation. You can try looking at my latest Entity Framework Crash Course - at the beginning, I show you how to set up C# and .NET support in Visual Studio Code.
01:13:00 What if a number isn't inputted? SO I went to Google and after a few failed attempts got this to work (NOTE to beginners such as myself is a line break): static void ConditionalStatements() { Console.WriteLine(" CONDITIONAL STATEMENTS "); Console.WriteLine("How old are you?: "); var ageAsAString = Console.ReadLine(); int age; bool parseTrue = int.TryParse(ageAsAString, out age); if (parseTrue) { if (age < 18) { Console.WriteLine($"You're a minor of {age} years old."); } else { Console.WriteLine($"You're an adult of {age} years old."); } } else { Console.WriteLine("This is not a number."); } }
If a number isn't inputted (as in int age;), then "age" is null, which means that no value has been set. So basically, your "else" block would be hit. However, in a real-world scenario, you would generally need a null check to avoid null pointer exceptions: if (age == null) { Console.WriteLine("No age was defined"); } else { // age has a value if (age > 18) { //... } else .... }
01:16:00 I'm getting an error even though its typed mostly like yours (Use of unassigned local variable dayName): int day = 3; string dayName; switch (day) { case 1: dayName = "Monday"; break; case 2: dayName = "Tuesday"; break; case 3: dayName = "Wednesday"; break; case 4: dayName = "Thursday"; break; case 5: dayName = "Friday"; break; case 6: dayName = "Saturday"; break; case 7: dayName = "Sunday"; break; } Console.WriteLine($"Today is {dayName}"); // ERROR Generates from this line for 'dayName'
Usually, "use of an unassigned variable" is a warning, not an error. If it's showing up as an error (with red text), try changing the variable assignment like this: string dayName = ""; If that doesn't work, ensure that your variable is declared in the same scope in which it's being used. So in this case, it should be in the same method, but outside of other code blocks. If all else fails, review the Github repo in the video description, and find the same file to compare your code to ours.
@@coderversity It works with your line of code: Console.WriteLine("Today is " + dayName); However, mine fails with this (it is a red error): Console.WriteLine($"Today is {dayName}"); The above (mine) only works if I put it inside the cases or if I assign dayName with a value. Your suggestion: string dayName = ""; Also worked.
"Dividing by zero will cause an error." Me thinking, "How can I just show it equals zero instead of displaying a random error message?" int num3 = 55; int num0 = 0; int overideZero = 0; try { int quotient = num3 / num0; Console.WriteLine(quotient); } catch (DivideByZeroException) { Console.WriteLine(overideZero); }
Sure, but in a real-world scenario, you may elect a different approach because the result of num3 / num0 is already 0, and the exception only gets thrown when you divide by zero. Another approach to avoid this exception would be to check if either of the values equal zero prior to dividing them - like this: if (num0 == 0 || num3 == 0) { Console.WriteLine("Invalid inputs. The quotient will always equal zero."); } else { int quotient = num3 / num0; // continue code... } Obviously, the try/catch approach is the best in this case because we won't need a special if statement to check whether each value equals 0.
@@coderversity And this isn't a real world scenario. Just me trying to figure out how to do extra stuff, looking it up, and trying it based on your tutorial.
Indeed always account for input being 0 or a non zero negative number, if your code should not be working with those numbers by using a condition and default value plus message. Exception handling should be the last resort.
Visual Studio for Mac has been retired. See this doc for more information: learn.microsoft.com/en-us/visualstudio/releases/2022/what-happened-to-vs-for-mac
That's what i call a crash course, covered literally everything you need on c# as a beginner, thank you for your time and effort!
Glad I could help! Thank you for the kind words!
The crash course provided here is of high quality and designed to be easily understandable for individuals transitioning from a different programming language. It effectively assists in building comfort with the syntax. Your next focus should be on grasping the OOP programming concept and understanding the .net framework, Visual Studio, and Git. By doing so, you are well on your way to becoming a skilled programmer.
Introduction to C# and .NET (0:00)
What is C#? (0:15)
What is .NET? (2:15)
Why use C#? (5:15)
Setting up Visual Studio (8:00)
Installing Visual Studio (8:15)
Creating a new C# project (15:00)
Variables and Data Types (15:00)
Declaring variables (15:15)
Data types (18:00)
Type conversion (22:00)
Operators (25:00)
Arithmetic operators (25:15)
Comparison operators (28:00)
Logical operators (30:00)
Control Flow Statements (35:00)
If/else statements (35:15)
Switch statements (42:00)
Loops (47:00)
For loops (47:15)
While loops (52:00)
Do-while loops (55:00)
Functions (55:00)
Defining functions (55:15)
Calling functions (58:00)
Parameters and arguments (1:02:00)
Return values (1:05:00)
Object-Oriented Programming (OOP) (1:08:00)
Classes and objects (1:08:15)
Properties and fields (1:15:00)
Methods (1:20:00)
Constructors (1:25:00)
Inheritance (1:30:00)
Polymorphism (1:35:00)
Error Handling (1:40:00)
Try-catch blocks (1:40:15)
Custom exceptions (1:45:00)
Conclusion (1:47:28)
Thanks!
The only crash course that hasnt made me wanna fall asleep and he explains it so well even a 14 year old like me can understand
Thanks for your feedback!
That really is a crash course. Concise and comprehensive. Cheers mate!
Thanks!
I'm a Mid Python Developer who is have a C# Interview and task. This is my first-time writing C#, but I swear it's one of the best tutorials i have ever seen. Keep going man.
Thanks for the video it's a real crash course. Best part is not specifying the highlight the most used feature. The video content is describing all the topic with equal priority. Love from Bangladesh 🐅
You are a wonderful teacher!
Be sure to comment below to let us know what other types of videos you'd like to see on this channel.
Thank you for a great video course!! It was very easy to follow and your explanations were clear and concise - thank you!!
Very nice intro to C# bud, thanks alot!
Thanks for this. Very helpful!
Great course for a refresh, could you dive more into oop topics like polymorphism inheritance enum and generics maybe?
Amazing video! Could you do a video on creating NinjaTrader indicators and/or strategies as they use the C# langueage too. Maybe even delve into creating add-ons for their software.
Great suggestion!
As a trader i would advise he does so too..
Great job man, fantastic video
Visual Studio Code works with Linux.
Thanks for confirming!
Thank you for this nice tutorial. Could you make a tutorial to cover the methods for beginners.(creating methods, calling methods, returning type and none returning types and etc.)
Most of these were covered in this video, but we can definitely consider these topics in a future video!
Bro this is a dope course many thanks to you !
Thanks Linda! Make sure you subscribe (if you haven't) and let others know about this channel! Stay tuned for more...
1:49:49
*pls ignore, just saving this for study purposes.
Ive tried the code and namespaces dont link. it says "the type or namespace name 'c_sharp_crash' (as seen in ur github) could not be found.
Hmmm...seems to be working for me. You can try creating a brand new Visual Studio solution from scratch, and just copy or re-write the code. If that still doesn't work, you might have a corrupted VS installation. You can try looking at my latest Entity Framework Crash Course - at the beginning, I show you how to set up C# and .NET support in Visual Studio Code.
Perfect 🤩 thanks
You’re welcome 😊
I have a quick question. Do you do videos for action personal training? You sound the same as the instructor
Nope, that's not me! LOL
01:13:00 What if a number isn't inputted? SO I went to Google and after a few failed attempts got this to work (NOTE to beginners such as myself
is a line break):
static void ConditionalStatements()
{
Console.WriteLine("
CONDITIONAL STATEMENTS
");
Console.WriteLine("How old are you?: ");
var ageAsAString = Console.ReadLine();
int age;
bool parseTrue = int.TryParse(ageAsAString, out age);
if (parseTrue)
{
if (age < 18)
{
Console.WriteLine($"You're a minor of {age} years old.");
}
else
{
Console.WriteLine($"You're an adult of {age} years old.");
}
}
else
{
Console.WriteLine("This is not a number.");
}
}
If a number isn't inputted (as in int age;), then "age" is null, which means that no value has been set. So basically, your "else" block would be hit. However, in a real-world scenario, you would generally need a null check to avoid null pointer exceptions:
if (age == null) {
Console.WriteLine("No age was defined");
} else {
// age has a value
if (age > 18) {
//...
} else ....
}
01:16:00
I'm getting an error even though its typed mostly like yours (Use of unassigned local variable dayName):
int day = 3;
string dayName;
switch (day)
{
case 1:
dayName = "Monday";
break;
case 2:
dayName = "Tuesday";
break;
case 3:
dayName = "Wednesday";
break;
case 4:
dayName = "Thursday";
break;
case 5:
dayName = "Friday";
break;
case 6:
dayName = "Saturday";
break;
case 7:
dayName = "Sunday";
break;
}
Console.WriteLine($"Today is {dayName}"); // ERROR Generates from this line for 'dayName'
Usually, "use of an unassigned variable" is a warning, not an error. If it's showing up as an error (with red text), try changing the variable assignment like this:
string dayName = "";
If that doesn't work, ensure that your variable is declared in the same scope in which it's being used. So in this case, it should be in the same method, but outside of other code blocks.
If all else fails, review the Github repo in the video description, and find the same file to compare your code to ours.
@@coderversity It works with your line of code:
Console.WriteLine("Today is " + dayName);
However, mine fails with this (it is a red error):
Console.WriteLine($"Today is {dayName}");
The above (mine) only works if I put it inside the cases or if I assign dayName with a value.
Your suggestion:
string dayName = "";
Also worked.
"Dividing by zero will cause an error."
Me thinking, "How can I just show it equals zero instead of displaying a random error message?"
int num3 = 55;
int num0 = 0;
int overideZero = 0;
try
{
int quotient = num3 / num0;
Console.WriteLine(quotient);
}
catch (DivideByZeroException)
{
Console.WriteLine(overideZero);
}
Sure, but in a real-world scenario, you may elect a different approach because the result of num3 / num0 is already 0, and the exception only gets thrown when you divide by zero.
Another approach to avoid this exception would be to check if either of the values equal zero prior to dividing them - like this:
if (num0 == 0 || num3 == 0) {
Console.WriteLine("Invalid inputs. The quotient will always equal zero.");
} else {
int quotient = num3 / num0;
// continue code...
}
Obviously, the try/catch approach is the best in this case because we won't need a special if statement to check whether each value equals 0.
@@coderversity And this isn't a real world scenario. Just me trying to figure out how to do extra stuff, looking it up, and trying it based on your tutorial.
Indeed always account for input being 0 or a non zero negative number, if your code should not be working with those numbers by using a condition and default value plus message. Exception handling should be the last resort.
39.07
Williams Patricia Anderson Jeffrey Lewis Daniel
you didnt even cover which workloads to install
Good callout. Feel free to contribute as a guest on our channel, and send us your video on this topic!
@@coderversity :D
Thanks man 🙂
No problem 👍
4:50
Is VS 2022 still available on Mac OS or do you have to use VSCode?
Visual Studio for Mac has been retired. See this doc for more information: learn.microsoft.com/en-us/visualstudio/releases/2022/what-happened-to-vs-for-mac