|
| 1 | +--- |
| 2 | +name: "Explore C# 7.0 - 7.3" |
| 3 | +description: "Explore the new features in the C# language released in versions 7.0 - 7.3. Learn to program interactively using the try.net interactive experience with .NET Core." |
| 4 | +page_type: sample |
| 5 | +languages: |
| 6 | + - csharp |
| 7 | +products: |
| 8 | + - dotnet-core |
| 9 | +--- |
1 | 10 | # What's new in C# 7.0 thru C# 7.3 - exploration |
2 | 11 |
|
3 | | -This exploration enables you to experiment with the features that have been released in C# 7.0, and the following point releases through C# 7.3. You can try the code in the samples, modify it, and see the effects of using the new features in a variety of scenarios. Some of the features added in the point releases are enhancements and improvements to features first available in C# 7.0. This exploration is organized around the themes across all the C# 7.x features, rather than by release. As you explore each area, enhancements that are available in later point releases are noted. |
4 | | - |
5 | | -The themes of these releases are: |
6 | | - |
7 | | -## Better control over allocations and copies |
8 | | - |
9 | | -The .NET environment manages memory automatically. However, some scenarios require developers to take more control over the memory footprint of their application. This has meant developers needed to write unsafe code. The goal of these features is to enable developers to achieve the performance of unsafe code while writing verifiably safe code. The features that enable these gains are: |
10 | | - |
11 | | -- [ref locals and returns](./ref-locals-returns.md) |
12 | | -- [in and ref readonly](./in-ref-readonly.md) |
13 | | -- [readonly struct](./readonly-struct.md) |
14 | | -- [ref struct](./readonly-struct#ref-struct-types.md) |
15 | | - |
16 | | -## Pattern matching |
17 | | - |
18 | | -Modern applications are often a collection of different programs that execute on multiple machines and platforms. That separates data from the code that consumes the data. A strict object oriented approach doesn't work as well in these systems. **Pattern matching** enables new ways to examine data using its type, shape, or values. The features added for pattern matching are: |
19 | | - |
20 | | -- [pattern matching is expressions](./is-expressions.md) |
21 | | -- [pattern matching with switch](./switch-patterns.md) |
22 | | -- [pattern matching on generic type elements](./generic-patterns.md) |
23 | | - |
24 | | -## Tuple data types |
| 12 | + |
25 | 13 |
|
26 | | -Tuples combine both of the previous themes: They are lightweight value types that contain multiple members: |
| 14 | +<p align ="center"> |
| 15 | +<img src ="https://user-images.githubusercontent.com/2546640/56708992-deee8780-66ec-11e9-9991-eb85abb1d10a.png" width="350"> |
| 16 | +</p> |
27 | 17 |
|
28 | | -- [Create lightweight data structures using tuples](./declare-tuples.md) |
29 | | - |
30 | | -## Preparing for nullable reference types |
31 | | - |
32 | | -Features were added to C# 7.x that make it easier to adopt nullable reference types in C# 8. These features reduce the locations where you must declare a variable and initialize it later. |
33 | | - |
34 | | -- [Declare out variables when assigned](./out-variable-declaration.md) |
35 | | - |
36 | | -Many of these use unsafe code, which aren't available in the local `dotnet try` environment. Learn more about them on docs.microsoft.com: |
37 | | - |
38 | | -- [fixed fields without pinning](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-3) |
39 | | -- [stackalloc array initializers](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-3#stackalloc-arrays-support-initializers) |
40 | | -- [Conditional ref expressions](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-2#conditional-ref-expressions) |
41 | | - |
42 | | -## Improve code organization and readability |
43 | | - |
44 | | -Other features improve your ability to write clear code in a variety of scenarios: |
45 | | - |
46 | | -- [local functions](local-functions.md) |
47 | | -- [new generic constraints ](generic-constraints.md) |
| 18 | +This exploration enables you to experiment with the features that have been released in C# 7.0, and the following point releases through C# 7.3. You can try the code in the samples, modify it, and see the effects of using the new features in a variety of scenarios. Some of the features added in the point releases are enhancements and improvements to features first available in C# 7.0. This exploration is organized around the themes across all the C# 7.x features, rather than by release. As you explore each area, enhancements that are available in later point releases are noted. |
48 | 19 |
|
49 | | -Two other features aren't in this tutorial. Learn more about them on docs.microsoft.com: |
| 20 | +## What's new in C# 7.0 thru C# 7.3 - exploration |
50 | 21 |
|
51 | | -- [attributes on backing fields of properties](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-3#attach-attributes-to-the-backing-fields-for-auto-implemented-properties) |
52 | | -- [Async Main methods](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-1#async-main) |
53 | | -- [default literal expressions](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-1#default-literal-expressions) |
54 | | -- [Leading underscores in numeric literals](https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-7-2#leading-underscores-in-numeric-literals) |
| 22 | +To run these samples, you'll need to follow the instructions on hte [dotnet/try-samples](https://github.com/dotnet/try-samples#basics) repository to install the global `dotnet try` tool in your .NET environment. |
55 | 23 |
|
56 | | -You can try these scenarios and features in C# 7.x by stepping through the different sections of this tutorial. Or, you can select any of the preceding links to go to the feature you want to explore first. |
| 24 | +Once you've installed the global tool, running `dotnet try` loads the samples into a browser. The browser pages introduce important programming concepts through interactive exercises you run in your browser. |
57 | 25 |
|
58 | | -## Next: [ref locals and returns »](./ref-locals-returns.md) |
| 26 | +If you loaded this page from `dotnet try`, click [here](index.md) to start the sample. (This link will not work in the samples browser). |
0 commit comments