中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

C# 語言歷史版本特性(C# 1.0到C# 8.0匯總)

2018-07-20    來源:編程學(xué)習(xí)網(wǎng)

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

歷史版本

C#作為微軟2000年以后.NET平臺開發(fā)的當(dāng)家語言,發(fā)展至今具有17年的歷史,語言本身具有豐富的特性,微軟對其更新支持也十分支持。微軟將C#提交給標(biāo)準(zhǔn)組織ECMA,C# 5.0目前是ECMA發(fā)布的最新規(guī)范,C# 6.0還是草案階段,C# 7.1是微軟當(dāng)前提供的最新規(guī)范。

這里僅僅列個提綱,由于C# 5.0是具有ECMA標(biāo)準(zhǔn)規(guī)范的版本,所以選擇C# 5.0作為主要版本學(xué)習(xí),并專題學(xué)習(xí)C# 6.0,7.0版本新特性。

C#語言規(guī)范GitHub庫參見:https://github.com/dotnet/csharplang

C#語言路線圖及開發(fā)中的特性參見: 
https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md

語言版本 發(fā)布時間 .NET Framework要求 Visual Studio版本
C# 1.0 2002.1 .NET Framework 1.0 Visual Studio .NET 2002
C# 1.1\1.2 2003.4 .NET Framework 1.1 Visual Studio .NET 2003
C# 2.0 2005.11 .NET Framework 2.0 Visual Studio 2005
C# 3.0 2007.11 .NET Framework 2.0\3.0\3.5 Visual Studio 2008
C# 4.0 2010.4 .NET Framework 4.0 Visual Studio 2010
C# 5.0 2012.8 .NET Framework 4.5 Visual Studio 2012\2013
C# 6.0 2015.7 .NET Framework 4.6 Visual Studio 2015
C# 7.0 2017.3 .NET Framework 4.6.2 Visual Studio 2017
C# 7.1 2017.6 .NET Framework Visual Studio 2017 v15.3預(yù)覽版
C# 8.0 待發(fā)布  .NET Framework 4.7.1  Visual Studio 2017 v15.7

C# 1.0 特性

第1個版本,編程語言最基礎(chǔ)的特性。

  • Classes:面向?qū)ο筇匦裕С诸愵愋?/li>
  • Structs:結(jié)構(gòu)
  • Interfaces:接口
  • Events:事件
  • Properties:屬性,類的成員,提供訪問字段的靈活方法
  • Delegates:委托,一種引用類型,表示對具有特定參數(shù)列表和返回類型的方法的引用
  • Expressions,Statements,Operators:表達(dá)式、語句、操作符
  • Attributes:特性,為程序代碼添加元數(shù)據(jù)或聲明性信息,運(yùn)行時,通過反射可以訪問特性信息
  • Literals:字面值(或理解為常量值),區(qū)別常量,常量是和變量相對的

C# 2特性 (VS 2005)

  • Generics:泛型
  • Partial types:分部類型,可以將類、結(jié)構(gòu)、接口等類型定義拆分到多個文件中
  • Anonymous methods:匿名方法
  • Iterators:迭代器
  • Nullable types:可以為Null的類型,該類可以是其它值或者null
  • Getter/setter separate accessibility:屬性訪問控制
  • Method group conversions (delegates):方法組轉(zhuǎn)換,可以將聲明委托代表一組方法,隱式調(diào)用
  • Co- and Contra-variance for delegates and interfaces:委托、接口的協(xié)變和逆變
  • Static classes:靜態(tài)類
  • Delegate inference:委托推斷,允許將方法名直接賦給委托變量

C# 3特性 (VS 2008)

  • Implicitly typed local variables:
  • Object and collection initializers:對象和集合初始化器
  • Auto-Implemented properties:自動屬性,自動生成屬性方法,聲明更簡潔
  • Anonymous types:匿名類型
  • Extension methods:擴(kuò)展方法
  • Query expressions:查詢表達(dá)式
  • Lambda expression:Lambda表達(dá)式
  • Expression trees:表達(dá)式樹,以樹形數(shù)據(jù)結(jié)構(gòu)表示代碼,是一種新數(shù)據(jù)類型
  • Partial methods:部分方法

C# 4特性 (VS 2010)

  • Dynamic binding:動態(tài)綁定
  • Named and optional arguments:命名參數(shù)和可選參數(shù)
  • Generic co- and contravariance:泛型的協(xié)變和逆變
  • Embedded interop types (“NoPIA”):開啟嵌入類型信息,增加引用COM組件程序的中立性

C# 5特性 (VS 2012)

  • Asynchronous methods:異步方法
  • Caller info attributes:調(diào)用方信息特性,調(diào)用時訪問調(diào)用者的信息

C# 6特征 (VS 2015)

  • Compiler-as-a-service (Roslyn)
  • Import of static type members into namespace:支持僅導(dǎo)入類中的靜態(tài)成員
  • Exception filters:異常過濾器
  • Await in catch/finally blocks:支持在catch/finally語句塊使用await語句
  • Auto property initializers:自動屬性初始化
  • Default values for getter-only properties:設(shè)置只讀屬性的默認(rèn)值
  • Expression-bodied members:支持以表達(dá)式為主體的成員方法和只讀屬性
  • Null propagator (null-conditional operator, succinct null checking):Null條件操作符
  • String interpolation:字符串插值,產(chǎn)生特定格式字符串的新方法
  • nameof operator:nameof操作符,返回方法、屬性、變量的名稱
  • Dictionary initializer:字典初始化

C# 7 特征 (Visual Studio 2017)

  • Out variables:out變量直接聲明,例如可以out in parameter
  • Pattern matching:模式匹配,根據(jù)對象類型或者其它屬性實(shí)現(xiàn)方法派發(fā)
  • Tuples:元組
  • Deconstruction:元組解析
  • Discards:沒有命名的變量,只是占位,后面代碼不需要使用其值
  • Local Functions:局部函數(shù)
  • Binary Literals:二進(jìn)制字面量
  • Digit Separators:數(shù)字分隔符
  • Ref returns and locals:引用返回值和局部變量
  • Generalized async return types:async中使用泛型返回類型
  • More expression-bodied members:允許構(gòu)造器、解析器、屬性可以使用表達(dá)式作為body
  • Throw expressions:Throw可以在表達(dá)式中使用

C# 7.1 特征 (Visual Studio 2017 version 15.3)

  • Async main:在main方法用async方式
  • Default expressions:引入新的字面值default
  • Reference assemblies:
  • Inferred tuple element names:
  • Pattern-matching with generics:

C# 8.0 特征 (Visual Studio 2017 version 15.7) 

  • Default Interface Methods 缺省接口實(shí)現(xiàn)
  • Nullable reference type NullableReferenceTypes  非空和可控的數(shù)據(jù)類型
  • Recursive patterns 遞歸模式
  • Async streams  異步數(shù)據(jù)流
  • Caller expression attribute 調(diào)用方法表達(dá)式屬性
  • Target-typed new
  • Generic attributes 通用屬性
  • Ranges
  • Default in deconstruction
  • Relax ordering of ref and partial modifiers

標(biāo)簽: 代碼

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:服務(wù)端性能優(yōu)化:Troubleshooting 兩則

下一篇:Webpack 4 配置最佳實(shí)踐