100个c#初学者编程实例_C#编程:初学者入门

100个c#初学者编程实例

C Sharp, more commonly referred to as “C#”, is a general-purpose, object-oriented programming language. C# was developed by Anders Hejlsberg and his development team at Microsoft and is currently on version 7.0.

C Sharp,通常称为“ C#”,是一种通用的,面向对象的编程语言。 C#由Anders Hejlsberg及其Microsoft的开发团队开发,当前版本为7.0。

C# has its roots in the family of C languages. It inherits most of its features from C, C++, and Java. For this reason, programmers familiar with these languages may be able to get up to speed with C# in a shorter time span.

C#起源于C语言家族。 它继承了C,C ++和Java的大部分功能。 因此,熟悉这些语言的程序员可能能够在较短的时间范围内熟悉C#。

C# is an object-oriented language that provides support for component-oriented and functional programming.

C#是一种面向对象的语言,为面向组件和功能的编程提供支持。

类和对象 (Classes and Objects)

Classes allow us to model everyday objects in the world around us in software. You can create custom classes to represent just about anything. Just like a noun is a person, place or thing in language, so too, a classes represents objects.

通过类,我们可以使用软件对周围世界中的日常对象进行建模。 您可以创建自定义类来表示几乎所有内容。 就像名词是语言中的人,地方或事物一样,类也表示对象。

When you write C# code, typically it is because you need a program that does something useful.

编写C#代码时,通常是因为您需要一个程序来做一些有用的事情。

In the case of a business need, you follow requirements that the business needs. Say your business comes to you asks you for an electronic database of books. They need to be able to store book titles, authors, compute statistics, like the number of checkouts in a given month, or a monthly average.

在业务需要的情况下,请遵循业务需要的要求。 说您的生意来了,您要求您提供电子图书数据库。 他们需要能够存储书名,作者,计算统计信息,例如给定月份或每月平均值的结帐次数。

The requirements describe the program that needs to be developed. How do you write a program for the given requirements?

需求描述了需要开发的程序。 您如何针对给定的要求编写程序?

Generally, we use classes to create abstractions for the different nouns that we need to work with. A noun such as a book, author, or title.

通常,我们使用类为需要使用的不同名词创建抽象。 名词,如书,作者或标题。

An important concept in C# is that the class definition is used to create instances of objects. You can think of it like a blueprint for creating instances of objects. The class definition allows the creation of objects that store a reference to that object. For example, say we want to create a new book object. The line of code looks like this:

C#中的一个重要概念是类定义用于创建对象的实例。 您可以将其视为创建对象实例的蓝图。 类定义允许创建存储对该对象的引用的对象。 例如,假设我们要创建一个新的书本对象。 代码行如下所示:

Book book = new Book();

This creates a new book object that we can use to manipulate data and store it in a database. The variable, book, is actually a reference type of Book (with a capital B). We can then use methods available in the class definition with that variable, book, such as AddTitle(), AddAuthor(), and so on.

这将创建一个新的书本对象,我们可以使用它来处理数据并将其存储在数据库中。 变量book实际上是Book的引用类型(大写字母B)。 然后,我们可以使用与该变量,书类定义可用的方法,如AddTitle() AddAuthor()等等。

C#的功能包括: (Features of C# include:)
  1. Automatic Garbage Collection

    自动垃圾收集
  2. Exception Handling

    异常处理
  3. Type-safety

    类型安全
  4. Versioning

    版本控制
  5. Delegates

    代表们
  6. Properties

    物产
  7. LINQ (Language-Integrated Query) and Lambda Expressions

    LINQ(语言集成查询)和Lambda表达式
  8. Generics

    泛型
  9. Indexers

    索引器
  10. Multithreading

    多线程
C#7.0中添加的新功能: (New Features Added in C# 7.0:)
  1. Deconstructors

    解构函数
  2. New syntax to work with Tuples

    与元组一起使用的新语法
  3. Pattern Matching with Is Expressions

    与Is表达式进行模式匹配
  4. Local Functions

    局部功能
  5. Return by Reference

    参考归还
  6. Out Variables

    输出变量
  7. Literal improvements

    字面改进
  8. Generalized Async Return Types

    广义异步返回类型
  9. More Expression-Bodied Members

    更多表情包成员
  10. Throw Expressions

    投掷表达式
  11. Record Type

    记录类型
  12. Minimizing OUT

    最小化输出
  13. Non-‘NULL’ able reference type

    不能为“ NULL”的引用类型
ASP.NET和.NET应用程序 (ASP.NET and .NET Applications)

The C# language is also used with the ASP.NET framework, developed by Microsoft Corp., specifically for creating web applications that are machine and browser independent.

C#语言还与Microsoft Corp.开发的ASP.NET框架一起使用,专门用于创建与计算机和浏览器无关的Web应用程序。

The broader .NET framework, also developed by Microsoft, is used for creating other types of applications such as desktop, mobile, server, and networking applications. The .NET framework includes the .NET Base Class Libraries (BCL), ASP.NET, ADO.NET, Windows Forms, Windows Presentation Foundation (WPF), and eXtensible Markup Language(XML) libraries.

也由Microsoft开发的更广泛的.NET框架用于创建其他类型的应用程序,例如桌面,移动,服务器和网络应用程序。 .NET框架包括.NET基类库(BCL),ASP.NET,ADO.NET,Windows窗体,Windows Presentation Foundation(WPF)和可扩展标记语言(XML)库。

翻译自: https://www.freecodecamp.org/news/csharp/

100个c#初学者编程实例

  • 5
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: C是英文字母表中的第三个字母,也是罗马数字中表示百的数字。在计算机编程语言中,C是一种高级编程语言,它是由贝尔实验室的Dennis Ritchie在20世纪70年代开发的。C语言具有简洁、灵活、高效的特点,被广泛应用于系统软件和应用软件的开发中。 C语言是一种面向过程的编程语言,它提供了丰富的数据类型和控制结构,使得程序开发变得灵活而自由。C语言具有良好的可移植性,同样的代码可以在不同的平台上进行编译和执行。此外,C语言的语法相对简单,易于学习和使用。 C语言的应用广泛,包括操作系统、编译器、数据库、游戏等领域。许多重要的软件和系统都是使用C语言开发的,如UNIX操作系统、Linux操作系统、MySQL数据库、Apache Web服务器等。C语言还是其他编程语言的基础,如C++、Objective-C、Java等都有很大程度上的借鉴C语言的特性。 总的来说,C语言具有高效、可移植、灵活和简洁的特点,在计算机编程领域有着广泛的应用。它不仅是编程入门的良好语言,也是学习其他编程语言的基础。 ### 回答2: C是一种非常重要的编程语言,它被广泛应用于软件开发和系统编程。C语言具有简洁、高效、灵活的特点,可以用于开发各种类型的应用程序。 首先,C语言拥有简单而直观的语法,易于学习和理解。它采用了类似自然语言的表达方式,使得编程人员可以直接将思想变成代码。 其次,C语言具有高效的执行速度和低的内存消耗。C语言的编译器可以将源代码直接转换为机器语言执行,所以可以实现更高效的运行。 然后,C语言非常灵活,可以进行底层的系统编程。它提供了丰富的库函数和系统调用接口,使得开发者可以直接访问底层的硬件和操作系统功能。 此外,C语言是许多其他编程语言的基础。它的设计思想和语法被广泛借鉴和继承,比如C++和Java语言即是基于C语言开发的,因此学习和掌握C语言可以为学习其他编程语言打下坚实的基础。 总结来说,C语言是一门重要的编程语言,具有简洁、高效、灵活的特点。无论是系统编程还是应用程序开发,掌握C语言都是必不可少的。对于想要从事软件开发或计算机科学领域的人来说,学习和掌握C语言将会有着重要的意义。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值