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 ExpressionsLINQ(语言集成查询)和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#初学者编程实例

100个c#初学者编程实例_C#编程:初学者入门相关推荐

  1. python编程实例-python编程实战

    广告关闭 2017年12月,云+社区对外发布,从最开始的技术博客到现在拥有多个社区产品.未来,我们一起乘风破浪,创造无限可能. 另外又学了几个python3的新decorator. 创建型设计模式抽象 ...

  2. c语言求跳水运动员成绩,跳水排名_C语言编程实例_C语言_最全面的网站教程

    问题描述:5位跳水高手参加10米高台跳水决赛,有好事者让5人据实力预测比赛结果. A选手说:B第二,我第三: B选手说:我第二,E第四: C选手说:我第一,D第二: D选手说:C最后,我第三: E选手 ...

  3. python脚本编程实例_C程序调用Python脚本的例子

    下面我们一起来看看关于C程序调用Python脚本的例子,如果你对此有兴趣的希望此教程对各位同学会有所帮助. 代码如下 复制代码 #include int main(){ PyObject * g_pM ...

  4. 三菱st语言编程实例_C语言编程实例39

    素数又称质数.所谓素数是指除了 1 和它本身以外,不能被任何整数整除的数,例如17就是素数,因为它不能被 2~16 的任一整数整除. 思路1):因此判断一个整数m是否是素数,只需把 m 被 2 ~ m ...

  5. android串口编程实例_PLC编程由浅到深 | 如何搞懂西门子PLC脉冲输出

    点击箭头处"工业之家",选择"关注公众号"! 如何搞懂西门子PLC脉冲输出 西门子S7-200PLC有两个PT0/PWM发生器(脉冲输出/脉宽调制),它们可以产 ...

  6. c语言编程字符串_C编程中的字符串

    c语言编程字符串 Strings in C programming are an array of characters with a NULL character ('\0') appended a ...

  7. python编程实例集合-编程小白如何结合量化实例学习python量化建模?

    结合编程和量化的内容,我们社区和学院有很多:BigQuant社区.推荐以下内容:策略开发 策略大都附有python代码,可以点击 克隆策略,在 我的策略 里进行开发. 2.编程知识入门 平台使用的是p ...

  8. scpi编程实例 c语言,SCPI_编程语句中文解释_scpi编程实例,scpi编程手册

    Standard Commands for Programmable Instruments的缩写,即程控仪器(可编程仪器)标准命令集.SCPI 是一种建立在现有标准IEEE488.1 和 IEEE ...

  9. hadoop中使用MapReduce编程实例

    原文链接:http://www.cnblogs.com/xia520pi/archive/2012/06/04/2534533.html 从网上搜到的一篇hadoop的编程实例,对于初学者真是帮助太大 ...

  10. java什么是函数式编程,Java 函数式编程(一)初识篇

    本文已授权"后端技术精选"独家发布. 开发者使用Java8编写复杂的集合处理算法,只需要简单的代码就能在多喝cpu上高效运行,这就是Lambda表达式的初衷. 提示:函数式编程和语 ...

最新文章

  1. Tensorflow nmt源码解析
  2. 第四范式恭祝大家新春快乐!
  3. ServiceStack学习之一准备工作
  4. c语言基础练习题 字符串输入scanf/gets 字符串赋值、比大小
  5. 叨叨20220304
  6. Python 只读属性的实现
  7. C语言 makefile
  8. python学习-- django 2.1.7 ajax 请求 进阶版
  9. native2ascii的使用
  10. PyHook3 的下载与安装
  11. 【snipaste下载和快捷键的修改】
  12. IB心理学生物分析模块
  13. 图片云存储服务商在阿里云和又拍云之间如何选择?
  14. mysql按天执行分区表sql_Mysql按天自动表分区教程
  15. 关于Navicat到期的办法(亲测有效)
  16. 在Blender中做一个小独角兽
  17. 基于Django框架实现前后端分离(三)
  18. Qt编写地图综合应用27-点聚合
  19. 动态更新阿里云DDNS解析记录的IPv6地址,随时随地用域名远程访问自己的电脑【如何远程访问家里的电脑】
  20. word文档怎么翻译成中文?不妨试试这几个方法

热门文章

  1. 记录一下mac mini 2018 的折腾过程
  2. javascript实现日历功能
  3. 汽车HiL测试简单介绍及其优势
  4. numpy学习:np.subtract.outer
  5. python机器学习记录4and5 支持向量机
  6. Qt Creator实现动画效果(单个动画)
  7. HydroGo-Pre 水动力学模型建模统一前处理系统使用说明
  8. 手机管理应用研究【5】——应用杂篇
  9. 22478计算机代码,数字2247代表啥意思 2247数字意思
  10. MegaCli命令关闭jbod模式