C# language

xingyun86 2021-5-30 882

C#

C# is a modern, high-level, general-purpose, object-oriented programming language. It is the principal language of the .NET framework. It supports functional, procedural, generic, object-oriented, and component-oriented programming disciplines.

The design goals of the language were software robustness, durability and programmer productivity. It can be used to create console applications, GUI applications, web applications, both on PCs and embedded systems. C# was created by Microsoft corporation. The name "C sharp" was inspired by musical notation where a sharp indicates that the written note should be made a semitone higher in pitch.

.NET

.NET is an open-source, general-purpose development platform maintained by Microsoft and the .NET community on GitHub. With .NET, we can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, and IoT.

$ dotnet --version
5.0.101

In order to work with .NET, we need to dowload and install .NET SDK. The .NET 5 supports C# 9.0.

Compiling C# programs

After installing .NET SDK, we can build our first C# program.

$ dotnet new console -o Simple

With the dotnet new console command, we create a new console application.

Program.cs
using System;

Console.WriteLine("This is C#");

This is a simple C# program that prints a message to the console.

$ dotnet run
This is C#

We compile and run a simple C# program with dotnet run.

Visual Studio Code

Visual Studio Code is a lightweight, powerful, modern source code editor which is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes including C# and .NET.

It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.

Sources

The following sources were used to create this tutorial:

In this part of the C# tutorial, we have introduced the C# language.


×
打赏作者
最新回复 (0)
只看楼主
全部楼主
返回