100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 100个c#初学者编程实例_C#编程:初学者入门

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

时间:2021-06-14 13:57:33

相关推荐

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 thatdoessomething 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 asAddTitle(),AddAuthor(), and so on.

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

C#的功能包括:(Features of C# include:)

Automatic Garbage Collection自动垃圾收集 Exception Handling异常处理 Type-safety类型安全 Versioning版本控制 Delegates代表们 Properties物产 LINQ (Language-Integrated Query) and Lambda ExpressionsLINQ(语言集成查询)和Lambda表达式 Generics泛型 Indexers索引器 Multithreading多线程

C#7.0中添加的新功能:(New Features Added in C# 7.0:)

Deconstructors解构函数 New syntax to work with Tuples与元组一起使用的新语法 Pattern Matching with Is Expressions与Is表达式进行模式匹配 Local Functions局部功能 Return by Reference参考归还 Out Variables输出变量 Literal improvements字面改进 Generalized Async Return Types广义异步返回类型 More Expression-Bodied Members更多表情包成员 Throw Expressions投掷表达式 Record Type记录类型 Minimizing OUT最小化输出 Non-‘NULL’ able reference type不能为“ NULL”的引用类型

和.NET应用程序(and .NET Applications)

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

C#语言还与Microsoft Corp.开发的框架一起使用,专门用于创建与计算机和浏览器无关的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), , , Windows Forms, Windows Presentation Foundation (WPF), and eXtensible Markup Language(XML) libraries.

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

翻译自: /news/csharp/

100个c#初学者编程实例

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。