lang | syntax | title | author |
---|---|---|---|
C# |
cs |
C# can be used to create almost anything but is particularly strong at building Windows desktop applications and games. |
hey-mikey |
public class HelloWorld {
public static void Main(string[] args) {
Console.WriteLine("Hello, World!");
Console.ReadLine();
}
}
- C# is a language developed by Microsoft in 2000 to address the growing interest in web applications. It was written by Anders Hejlsberg, who also worked on Turbo Pascal and Delphi.
- It's useful for desktop applications as well as mobile and cross-platform applications, too.
- With the Unity game engine, developers can also create games with C#
- C# is remarkably scalable and easy to maintain.
- It's good for beginners, especially beginners with experience with Java or C++ because the code syntax is very similar
- It's possible to write applications for desktop, web, mobile, games, and cross-platform with C#. Cool stuff!
- C# is statically-typed and easy to read, and it's object-oriented, another thing it has in common with Java.
- According to a 2020 StackOverflow study, C# is an in-demand skill and among the top ten languages used.
To start building .NET apps, download and install the .NET SDK (Software Development Kit)
Once you've installed, open a new command prompt and run the following command:
dotnet
If you receive a 'dotnet is not recognized as an internal or external command' error, make sure you opened a new command prompt.
In the command prompt again, write
dotnet new console -o myApp
then navigate to that directory
cd myApp
The main file in the myApp folder is Program.cs. By default it's already written to print "Hello World!" to the Console.
- Download and install the free version of Visual Studio.
- Open Visual Studio, and choose "Create a new project" in the Start window.
- Choose
C#
from the Language list. - Choose
Windows
from the platform list. - Choose
Console
from the project types list. - Once your new project loads, you can add
.cs
files or edit the existing automatically-included.cs
file.
C# is a very flexible and beginner-friendly language, and it's used in a multitude of contexts from the web to desktop to mobile gaming. It's not difficult to get started with C#, and it will allow you to create a wide variety of projects and applications. Sky's the limit!
Thanks for reading ✨