C# 快速入门C# Quickstarts

欢迎阅读 C# 快速入门。Welcome to the C# Quickstarts. 本系列教程从可以在浏览器中演练的交互式课程入手。These start with interactive lessons that you can run in your browser.

头几个课程通过小篇幅的代码片段介绍了 C# 概念。The first lessons explain C# concepts using small snippets of code. 读者将了解 C# 语法的基础知识,以及如何使用字符串、数字和布尔值等数据类型。You'll learn the basics of C# syntax and how to work with data types like strings, numbers, and booleans. 全都是交互式课程,读者可以在几分钟内编写并运行代码。It's all interactive, and you'll be writing and running code within minutes. 无需事先了解编程或 C# 语言,即可学习头几个课程。These first lessons assume no prior knowledge of programming or the C# language.

可以使用联机浏览器或在自己的本地开发环境中学习 Hello World 课程之后的所有快速入门教程。All the quickstarts following the Hello World lesson are available using the online browser experience or in your own local development environment. 每个快速入门教程结束时,你可以决定是继续在线学习还是在自己的计算机上学习下一个快速入门教程。At the end of each quickstart, you decide if you want to continue with the next quickstart online or on your own machine. 可以访问相关链接设置自己的环境并继续在自己的计算机上学习下一个快速入门。There are links to help you setup your environment and continue with the next quickstart on your machine.

Hello WorldHello world

Hello world 快速入门中,你将创建最基本的 C# 程序。In the Hello world quickstart, you'll create the most basic C# program. 读者将探索 string 类型以及如何使用文本。You'll explore the string type and how to work with text.

C# 中的数字Numbers in C#

C# 中的数字快速入门教程中,将了解计算机如何存储数字,以及如何对不同类型的数字执行运算。In the Numbers in C# quickstart, you'll learn how computers store numbers and how to perform calculations with different numeric types. 读者将学习四舍五入的基础知识,以及如何使用 C# 执行数学运算。You'll learn the basics of rounding, and how to perform mathematical calculations using C#. 本快速入门也可下载到计算机本地进行学习This quickstart is also available to run locally on your machine.

若要更好地学习本快速入门教程,需要先完成 Hello World 课程。This quickstart assumes that you have finished the Hello world lesson.

分支和循环Branches and loops

分支和循环快速入门教程中,将了解根据变量中存储的值选择不同代码执行路径的基础知识。The Branches and loops quickstart teaches the basics of selecting different paths of code execution based on the values stored in variables. 读者将学习控制流的基础知识,这是程序决定选择不同操作的基本依据。You'll learn the basics of control flow, which is the basis of how programs make decisions and choose different actions. 本快速入门也可下载到计算机本地进行学习This quickstart is also available to run locally on your machine.

若要更好地学习本快速入门教程,需要先完成 Hello WorldC# 中的数字课程。This quickstart assumes that you have finished the Hello world and Numbers in C# lessons.

字符串内插String interpolation

字符串内插快速入门教程将介绍如何将值插入字符串。The String interpolation quickstart shows you how to insert values into a string. 你将学习如何创建带有嵌入式 C# 表达式的内插字符串,以及如何控制结果字符串中表达式结果的文本外观。You'll learn how to create an interpolated string with embedded C# expressions and how to control the text appearance of the expression results in the result string. 本快速入门也可下载到计算机本地进行学习This quickstart is also available to run locally on your machine.

若要更好地学习本快速入门课程,需要先完成 Hello WorldC# 中的数字分支和循环课程。This quickstart assumes that you have finished the Hello world, Numbers in C#, and Branches and loops lessons.

列表集合List collection

列表集合课程将介绍存储一系列数据的列表集合类型。The List collection lesson gives you a tour of the List collection type that stores sequences of data. 读者将学习如何添加和删除项、如何搜索项,以及如何对列表进行排序。You'll learn how to add and remove items, search for items, and sort the lists. 读者将探索各种列表。You'll explore different kinds of lists. 本快速入门也可下载到计算机本地进行学习This quickstart is also available to run locally on your machine.

若要更好地学习本快速入门教程,需要已完成上面列出的课程。This quickstart assumes that you have finished the lessons listed above.

类简介Introduction to classes

只能在计算机上使用自己的本地开发环境和 .NET Core 演练最后一个快速入门教程。This final quickstart is only available to run on your machine, using your own local development environment and .NET Core. 读者将生成控制台应用程序,并了解 C# 语言中面向对象的基本功能的工作原理。You'll build a console application and see the basic object-oriented features that are part of the C# language.

本基础快速入门需要你已完成联机快速入门教程,并已安装 .NET Core SDKVisual Studio CodeThis quickstart assumes you've finished the online quickstarts, and you've installed .NET Core SDK and Visual Studio Code.