[#1] Learn how to Code - C# Beginner Tutorial
C# Beginner Tutorial
Me and myself
First of all, I want to introduce myself shortly. My name is George, I'm 23 years old and I learned to code in school. I was 15 years old as I started to code. Now I'm working for hardly 2 years as C# Programmer at a small company. I'm by far not a pro but I think I'm able to teach the basics 😉
Why I'm doing this
In my opinion, coding will be very important in the future. Everbody should understand the basics because it will be everywhere in everyone's life. Coding seems very complex in the beginning but If you have understood the basics one time you can do a lot with it. Even in different coding languages. So be patient and don't give up! 😃
Why C#
The best thing about C# or any other language in the .Net Framework is that you can use Visual Studio (VS) as IDE (integrated development environment). VS is a very powerful tool and if you ever used Eclipse or Netbeans for Java you know how good VS is! (sorry I'm a little C# fanboy :-D)
Secondly, I'm a 100% Windows User and with C# it's very easy to create desktop software with WinForms/WPF.
Preparations
The first thing you should do is to download Visual Studio. It's a big and powerful tool so the installation needs some time. Hit the Link! Visual Studio 2017
The installation is straightforward to the workloads screen:
https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio
Here you have to choose what you want to install. No worry you can modify this at any time but better you install all you will need right now:
- Universal Windows Platform development
- .NET desktop Development
- Data storage and processing
Your first Project
How I hated the theory coding hours in school! So let's stop talking and start coding!
Open up VS2017 and hit File -> New -> Project. Now you will see this screen:
Search for Visual C# on the left and click on Console App(.Net Framework). Type in a name at the bottom (example: FirstConsoleApp) and click Ok. Visual Studio is now creating a Solution, adds the Console Project and adds a Program.cs Class to the Project.
In the Program.cs Class we are able to start coding.
Change
static void Main(string[] args)
{
}
to
static void Main(string[] args)
{
Console.WriteLine("Hello Steemit");
}
and use the shortcut Ctrl + F5 to build and run the program. If everything is working in the correct way a console window will pop up:
Okay great if this is working but it's a little boring right? Add some fun.
Change to
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Hello Steemit");
Console.WriteLine("Calculator");
Console.WriteLine("Type in the first number");
int number1 = int.Parse(Console.ReadLine());
Console.WriteLine("Type in the second number");
int number2 = int.Parse(Console.ReadLine());
int result = number1 + number2;
Console.WriteLine(number1 + " + " + number2 + " = " + result);
}
and start it again! Great we now are able to sum numbers and change the font color!
Very easy and basic stuff but I think you're now able to play a little bit around with this knowledge.
Next Post
I will keep this lessons short because of coding needs time. Trial and error method is a good start - you will learn a lot.
In the next post, I will split the code from this post up. What it means and do in the background. Yeah, I know - theory - but I will keep it simple and short 😉
Have a nice day
Geggi632
nice post congrats🙂
Congratulations @geggi632! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Congratulations @geggi632! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Semi Finals - Day 1
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes
Congratulations @geggi632! You have received a personal award!
2 Years on Steemit
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard: