C# 简介Introduction to C#

欢迎学习 C# 教程简介。Welcome to the introduction to C# tutorials. 这些课程先介绍你可在浏览器中运行的交互式代码。These lessons start with interactive code that you can run in your browser. 在开始这些互动课程之前,可在C# 101 视频系列中了解 C# 的基础知识。You can learn the basics of C# from the C# 101 video series before starting these interactive lessons.

开始的几个课程通过小篇幅的代码片段介绍了 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.

可在不同的环境中尝试这些教程。You can try these tutorials in different environments. 你将学习的概念是相同的。The concepts you'll learn are the same. 区别在于你更喜欢哪种体验:The difference is which experience you prefer:

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

Hello WorldHello world

Hello world 教程中,你将创建最基本的 C# 程序。In the Hello world tutorial, you'll create the most basic C# program. 读者将探索 string 类型以及如何使用文本。You'll explore the string type and how to work with text. 还可使用 Microsoft Learn 上的路径或 Binder 上的 JupyterYou can also use the path on Microsoft Learn or Jupyter on Binder.

C# 中的数字Numbers in C#

C# 中的数字教程中,将了解计算机如何存储数字,以及如何对不同类型的数字执行计算。In the Numbers in C# tutorial, 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 tutorial is also available to run locally on your machine.

该教程假定你已完成 Hello world 课程。This tutorial assumes that you've finished the Hello world lesson.

分支和循环Branches and loops

分支和循环教程中,将了解根据变量中存储的值选择不同代码执行路径的基础知识。The Branches and loops tutorial 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 tutorial is also available to run locally on your machine.

该教程假定你已完成 Hello WorldC# 中的数字课程。This tutorial assumes that you've finished the Hello world and Numbers in C# 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 tutorial is also available to run locally on your machine.

该教程假定你已完成上面列出的课程。This tutorial assumes that you've finished the lessons listed above.

类简介Introduction to classes

只能在计算机上使用自己的本地开发环境和 .NET Core 演练最后一个教程。This final tutorial 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 tutorial assumes you've finished the online introductory tutorials, and you've installed .NET Core SDK and Visual Studio Code.