New features of C# 4.0 syntax

C#4.0,.NET Framework 4.0, Visual Studio 2010 

The newly introduced syntax of C# 4.0 is based on .Net Framework 4.0. Mainly introduced syntax: dynamic typing, named parameters, optional parameters, optimized Com calls

The most important of these are dynamic types

 

Dynamic binding: Dynamic binding, that is, dynamic type, determines its type at runtime. Use the keyword dynamic to define

Named and optional arguments: Named and optional arguments

Generic co- and contravariance: Covariance and contravariance of generics, increase generics and use in/out to correspond to covariance and contravariance.

Embedded interop types ("NoPIA"): Enable embedded type information to increase the neutrality of referencing COM component programs. Eliminate unnecessary parameters when calling the Com interface.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324810085&siteId=291194637