Skip to content

codefinity/C-Sharp-Features

Repository files navigation

C Sharp Language Features

C# 1

  • Classes
  • Structs
  • Interfaces
  • Events
  • Properties
  • Delegates
  • Operators and expressions
  • Statements
  • Attributes

C# 2

  • Generics
  • Partial types
  • Anonymous methods
  • Nullable value types
  • Iterators
  • Covariance and contravariance

C# 3

  • Auto-implemented properties
  • Anonymous types
  • Query expressions
  • Lambda expressions
  • Expression trees
  • Extension methods
  • Implicitly typed local variables
  • Partial methods
  • Object and collection initializers

C# 4

  • Dynamic binding
  • Named/optional arguments
  • Generic covariant and contravariant
  • Embedded interop types

C# 5

  • Asynchronous members
  • Caller info attributes

C# 6

  • Static imports
  • Exception filters
  • Auto-property initializers
  • Expression bodied members
  • Null propagator
  • String interpolation
  • nameof operator
  • Index initializers

C# 7.0

  • Out variables
  • Tuples and deconstruction
  • Pattern matching
  • Local functions
  • Expanded expression bodied members
  • Ref locals and returns

Other features included:

  • Discards
  • Binary Literals and Digit Separators
  • Throw expressions

C# 7.1

  • async Main method
  • default literal expressions
  • Inferred tuple element names
  • Pattern matching on generic type parameters

C# 7.2

  • Techniques for writing safe efficient code
  • Non-trailing named arguments
  • Leading underscores in numeric literals
  • private protected access modifier
  • Conditional ref expressions

C# 7.3

The following new features support the theme of better performance for safe code:

  • You can access fixed fields without pinning.
  • You can reassign ref local variables.
  • You can use initializers on stackalloc arrays.
  • You can use fixed statements with any type that supports a pattern.
  • You can use additional generic constraints.

The following enhancements were made to existing features:

  • You can test == and != with tuple types.
  • You can use expression variables in more locations.
  • You may attach attributes to the backing field of auto-implemented properties.
  • Method resolution when arguments differ by in has been improved.
  • Overload resolution now has fewer ambiguous cases.

The new compiler options are:

  • -publicsign to enable Open Source Software (OSS) signing of assemblies.
  • -pathmap to provide a mapping for source directories.

C# 8

  • Readonly members
  • Default interface methods
  • Pattern matching enhancements:
    • Switch expressions
    • Property patterns
    • Tuple patterns
    • Positional patterns
  • Using declarations
  • Static local functions
  • Disposable ref structs
  • Nullable reference types
  • Asynchronous streams
  • Indices and ranges
  • Null-coalescing assignment
  • Unmanaged constructed types
  • Stackalloc in nested expressions
  • Enhancement of interpolated verbatim strings

C# 9

Not yet released

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages