What's New in C#7 and C# 8
4.3 (424 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
6,595 students enrolled

What's New in C#7 and C# 8

Learn about latest features of C#7 and C#8
4.3 (424 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
6,595 students enrolled
Created by Dmitri Nesteruk
Last updated 5/2019
English
English [Auto]
Current price: $34.99 Original price: $49.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 3 hours on-demand video
  • 1 article
  • 18 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Understand and appreciate C#7 and C#8 language features
  • Learn how to use new language features in practice
Course content
Expand all 32 lectures 03:13:47
+ Introduction
1 lecture 02:08

A description of the contents of this course.

Preview 02:08
+ What's New in C# 7
10 lectures 53:15

It used to be the case that, in order to use an out variable, you had to declare it first. Well, not anymore!

Preview 03:09

Not quite the F# pattern-matching on structural types, but it's a start.

Pattern Matching
04:51

Better tuples with names and deconstruction. Somewhat ruined by the requirement of an external Nuget package.

Update: System.ValueTuple is now part of .NET Framework 4.7.

Tuples
14:17

What is deconstruction and why should you care?

Deconstruction
03:02

Functions inside functions, what could be simpler?

Local Functions
05:55

References! Just like in C++, except not quite.

Ref Returns and Locals
11:25

A community-proposed feature of extending expression bodies to constructors/destructors and getters/setters.

Expression Bodied Members
02:14

Throw from a null-coalescing expression? What madness is this?

Throw Expessions
03:17

Async method return types are no longer restricted to void/Task/Task<T>.

Preview 03:35

Underscores in decimal, hex and binary literals.

Literal Improvements
01:30
+ What's New in C# 7.1
6 lectures 35:14

If you make a new project in Visual Studio 2017.3 and try to use a C#7.1 feature, the project won't compile. Why is that?

Oh, and what happens if your assembly has multiple Main methods, some async and some not?

Preview 02:13

The Main() method can now be marked async and is allowed to return a Task or Task<int>.

Async Main
07:54

Watch the default keyword become a literal (similar to the null literal) and start taking on additional responsibilities.

Default Expessions
07:09

Learn about assemblies whose method bodies are replaced with throw
null
.

Ref Assemblies
06:08

Just as the name suggests, this feature allows us, in certain cases, to infer tuple names and lets us omit them.

Infer Tuple Names
08:47

C# 7.1 makes it easier to pattern-match against a variable of a generic type.

Preview 03:03
+ What's New in C# 7.2
7 lectures 42:05

You can now put an underscore after a binary (0b) or hexadecimal (0x) literal prefix.

Leading Digit Separators
02:26

A new access modifier called 'private protected' was introduced. Learn what it's for and how it is different from 'protected internal'.

'private protected' Access Modifier
05:30

Named arguments can now appear before positional ones.

Non-trailing named arguments
02:51

Value types can now be passed by reference. What magic is this?

Preview 10:47

Since references to value types are meant to be readonly (otherwise, just pass by value), we have a new 'ref readonly' qualifier.

'ref readonly' Variables
06:14

The 'ref struct' feature was designed specifically for Span<T> in mind... shame that the type itself is not yet ready.

'ref struct' and Span<T>
07:35

Even though Span<T> is still in prerelease form, let's take a look at it anyway! Its internal mechanics will change, but the public API probably won't.

Span<T> Demo
06:42
+ What's New in C# 7.3
4 lectures 15:13

Improvements to C#, related mainly to unsafe memory manipulations.

Performance Improvements
06:18

Some minor improvements to existing C# features.

Feature Enhancements
04:12

Three new compiler flags!

OOPS: the explanation for -publicsign is incorrect and will be fixed! Sorry!

New Compiler Features
04:28

A couple of links to my other .NET/C# courses!

Bonus Lecture: Other Courses at a Discount
00:15
+ What's New in C# 8 [BETA]
4 lectures 45:51

Probably the worst, most incorrect name given to a feature, Nullable Reference Types are a new way of generating null-related warnings.

Nullable Reference Types
14:43

Two new pieces of syntactic sugar and two new types, Index and Range, help you index into and take parts of collections easier.

Indices and Ranges
12:04

A rather controversial feature, default interface members allow you to patch interfaces after deployment with concrete implementations. .NET Core only!

Default Interface Members
09:38

Continuing to steal features from F#, pattern matching is now augmented with many useful features.

Preview 09:26
Requirements
  • Knowledge of C# 6 and earlier
Description

This short course covers the latest and greatest features of C#, covering versions 7, 7.1, 7.2, 7.3 and 8.0 [BETA] of the language that are being sim-shipped with corresponding Visual Studio updates.

Course Topics

Here's every language feature presented in this course, grouped by the version of the C# language.

C# 7:

  • Out Variables

  • Pattern Matching (is and switch expressions)

  • Tuples and Tuple Deconstruction

  • Local Functions

  • Ref Returns and Locals

  • Expression Bodied Members

  • Throw Expressions

  • Generalized Async Return Types

  • Literal Improvements

C# 7.1:

  • How to turn on C# 7.1 support

  • Async Main

  • Default Expressions

  • Ref Assemblies

  • Infer Tuple Names

  • Pattern-Matching with Generics

C# 7.2:

  • Leading Digit Separators

  • 'Private Protected' Access Modifier

  • Non-Trailing Named Arguments

  • Reference Semantics on Value Types:

    • 'In' Parameters

    • 'Ref Readonly' Variables

    • 'Ref Struct' and Span<T>

C# 7.3:

  • Performance improvements

    • Access fixed fields without pinning

    • Reassign ref local variables

    • Use initializers on stackalloc arrays 

    • Use fixed statements on any type that supports a pattern 

  • Enhancements to existing features 

    • Tuple == and != support 

    • Use expression variables in more locations 

    • Attach attributes to backing field of auto-properties 

    • Improved method resolution when arguments differ by 'in' 

    • Improved overload resolution 

  • New compiler options: 

    • deterministic

    • publicsign

    • pathmap

C# 8 [BETA]:

  • Nullable Reference Types

  • Indices and Ranges

  • Default Interface Members

  • Pattern Matching

Prerequisites

  • Knowledge and understanding of C# 6 and earlier

  • General experience in .NET/C# application development

Learning Outcomes

  • An understanding and appreciation of latest C# 7/7.1/7.2/7.3/8 language features

  • Understanding of how to convert existing C# code to C# 7/7.1/7.2/7.3/8

Who this course is for:
  • Beginner and experienced .NET/C# developers