New Features in C# 3.0, 4.0 and 5.0 (英文差的免入)

简介: What’s New in C# 3.0   Language Integrated Query(LINQ)    - LINQ enables queries to be written in C# program to query both local collections      (s...

What’s New in C# 3.0

  Language Integrated Query(LINQ)

   - LINQ enables queries to be written in C# program to query both local collections
      (such as lists or XML documents) or remote data sources (such as a database)

  Implicitly typed local variables

   -  let you omit the variable type in a declaration statement, allowing the compiler to infer it

 Object initializers

   - simplify object construction by allowing properties to be set inline after the constructor call

 Lambda expressions

   - miniature functions created by the compiler on the fly, and are particularly useful in “fluent” LINQ queries

 Extension methods

   - extend an existing type with new methods, making static methods feel like instance methods

 Query expressions

   - provide a higher-level syntax for writing LINQ queries that can be substantially simpler when working

      with multiple sequences or range
       variables

  Expression trees

    - miniature code DOMs that describe lambda expressions assigned to the

       special type Expression<TDelegate>

       Expression trees make it possible for LINQ queries to execute remotely

   Automatic properties

    - cut the work in writing properties that simply get/set a private backing field by having the compiler do that work automatically 

  Partial methods

    - let an auto-generated partial class provide customizable hooks for manual authoring which “melt away” if unused

 

What’s New in C# 4.0

   Dynamic binding

     - defers binding

    Optional parameters

     - allow functions to specify default parameter values so that callers can omit arguments and named arguments

       allow a function caller to identify an argument by name rather than position

   Type variance rules

     - type parameters in generic interfaces and generic delegates can be marked as covariant or
        contravariant, allowing more natural type conversions

   COM interoperability

 

What’s New in C# 5.0

  C# 5.0’s big new feature is support for asynchronous functions via two new
  keywords, async and await. Asynchronous functions enable asynchronous continuations,
  which make it easier to write responsive and thread-safe rich-client applications.
  They also make it easy to write highly concurrent and efficient I/O-bound
  applications that don’t tie up a thread resource per operation

 

 

 

目录
相关文章
|
10月前
|
C语言 C++
PAT (Basic Level) Practice (中文)1099 性感素数(20分)
“性感素数”是指形如 (p, p+6) 这样的一对素数。之所以叫这个名字,是因为拉丁语管“六”叫“sex”(即英语的“性感”)。(原文摘自 http://mathworld.wolfram.com/SexyPrimes.html) 现给定一个整数,请你判断其是否为一个性感素数。
81 0
|
11月前
|
人工智能 自然语言处理 机器人
告诉Stable Diffusion 2.0你不想要什么,生成效果更好:Negative Prompt显奇效(2)
告诉Stable Diffusion 2.0你不想要什么,生成效果更好:Negative Prompt显奇效
474 0
|
Java Maven Android开发
给定一个汉字句子,可以输出句子的读音。借鉴第三方库:pinyin4j 。
给定一个汉字句子,可以输出句子的读音。借鉴第三方库:pinyin4j 。
给定一个汉字句子,可以输出句子的读音。借鉴第三方库:pinyin4j 。
|
测试技术
PAT (Basic Level) Practice (中文)1012 数字分类 (20 分)+易错测试点
PAT (Basic Level) Practice (中文)1012 数字分类 (20 分)+易错测试点
97 0
PAT (Basic Level) Practice (中文)1012 数字分类 (20 分)+易错测试点
PAT (Basic Level) Practice (中文) 1010 一元多项式求导 (25 分)
PAT (Basic Level) Practice (中文) 1010 一元多项式求导 (25 分)
72 0
|
算法
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
PAT (Basic Level) Practice (中文)1028. 人口普查(20分)
76 0
PAT (Basic Level) Practice (中文)- 1034 有理数四则运算(20 分)
PAT (Basic Level) Practice (中文)- 1034 有理数四则运算(20 分)
77 0
PAT (Basic Level) Practice (中文)- 1073 多选题常见计分法(20 分)
PAT (Basic Level) Practice (中文)- 1073 多选题常见计分法(20 分)
102 0
|
人工智能
PAT (Basic Level) Practice (中文)- 1049 数列的片段和(20 分)
PAT (Basic Level) Practice (中文)- 1049 数列的片段和(20 分)
76 0
|
算法 ice
Google Earth Engine ——MYD10A1 V6 Snow Cover Daily Global 500m产品包含雪盖、雪反照率、雪盖分率和质量评估(QA)数据归一化差异积雪指数数据集
Google Earth Engine ——MYD10A1 V6 Snow Cover Daily Global 500m产品包含雪盖、雪反照率、雪盖分率和质量评估(QA)数据归一化差异积雪指数数据集
164 0
Google Earth Engine ——MYD10A1 V6 Snow Cover Daily Global 500m产品包含雪盖、雪反照率、雪盖分率和质量评估(QA)数据归一化差异积雪指数数据集