Microsoft advises that .NET Core 3.0 is the future of the ecosystem and that programmers should use it for all new development projects. They’re making a ton of innovative changes to .NET Core, adding more workloads, helping you in your applications, be more productive, quicker, faster and better. In this presentation we look forward to what's new in .NET and C# for 2019
3. • Years of backwards compatibility for .NET is limiting
the teams with future development.
• .NET Framework is slowing down
• They will continue to update
• No changes to support policy
• Recommend new development on .NET Core
The Future of .NET Framework
4. Don’t Panic!
• You don’t have
to move!
New
development
• .NET Core is a
good choice
Existing code
• Costs and
benefits to
migrating
TheBottom Line
5. CORE 3.0
• Side-by-side and App-local Deployment
• Easily convert existing Desktop
applications to .Net Core 3
• Improvement to Project Files
• Continue to support Controls, NuGet
Packages, and Existing Assembly
References
6. Modernize Desktop Apps with .NET Core 3
Highly-compatible,
targeted improvements,
like last few releases
UWP
Windows-only
WEB
ASP.NET
Core
EF 6
EF Core
AI/ML
ML.NET
WPF
.NET Core 3.NET Framework 4.8
Existing
App
Highly
compatible
updates
Install .NET
Core updates
per your
needs
Windows-only Cross-platform
DATA
Windows
Forms
.NET STANDARD
Update .NET Framework Apps
8. What Goes Where
• Desktop Apps -> .NETCore 3
• Business Logic -> .NET Standard
• BackEndAPls -> .NETCore 3
• Front EndWeb Apps -> Well, this istougher...
9. Migrating a Typical .NET App Partially to the Cloud
On-Premises
WPF App
Windows .NET Framework
Web API Back End
Windows .NET Framework
SQL
Database
1
On-Premises
WPF App
Windows .NET Framework
Web API Back End
Windows .NET Core
SQL
Database
2
Cloud
On-Premises
WPF App
Windows .NET Framework
Web API Back End
Windows .NET Core
SQL
Database
3
10. Handling Shared Code When Targeting Multiple .NET Implementations
WPF App
.NET Framework
Web API Back End
.NET Framework
1
Business Logic
.NET Framework
WPF App
.NET Framework
Web API Back End
.NET Core
2
Business Logic
.NET Standard
12. What to expect in porting desktop apps to
Core
• Update project files to target .NET Core 3
and recompile.
• Dependencies will not need to retarget and
recompile. There will be additional benefits if you
update dependencies.
14. What is .NET Standard?
.NET Standard is a specification
A set of APIs that all .NET platforms must
implement
$ dotnet new classlib -o My.Class.Library
15. .NET Standard is represented by
The NuGet package NetStandard.Library which contains
The reference assembly netstandard.dll
At build time
.NET Standard bridges references to existing .NET Framework and PCL
assemblies via type forwarding
At runtime
Each platform provides an implementation for netstandard.dll that type
forwards to its implementation
• .NET Core is an implementation of the .NET Standard
• .NET Standard updates are coordinated across all .NET implementers
• .NET Core can be updated independently
How does .NET Standard work?
17. Windows Compatibility Pack
• Microsoft.Windows.Compatibility (NuGet package)
• Can be referenced from .NETCore as well as from .NETStandard
• Has ~21 k Api’s (Windows-only as well as cross-platform)
• Contents
ACLs
Code Pages
Code Dom
Configuration
Crypto
DirectoryServices
Drawing
EventLog
MEF v1
Odbc
Perf Counters
Permissions
Ports
Registry
Runtime Caching
WCF
Windows Services
18. Detecting usage of unsupported APIs
• Use API Analyzer!
• https://aka.ms/apianalyzer
• Warns about potential compatibility issues and calls to deprecated APIs.
22. 8.0 High probability
• New types
• Asynchronous Streams & Iterators &
dispose
• Default interface implementations
• Extension everything
• Records
• Discriminated unions
• Params Span
23. Types
• Part of .NET Standard 2.1 and C# 8
• The new Index type
• The Range type
• Nullable reference types
• .Net Core 3.0, Xamarin, Unity, and Mono will implement the
2.1 version
• .Net Framework 4.8 will not!
• Types required to use these features will not be available
when C# 8. 0 is targeted to .Net Framework 4.8
24. Index and Range TYPES
Index Expressions
var lastCharacter = myString[myString.Length-1];
var lastCharacter = myString[^1];
Index nextIndex = ^(x + 1); var nextChar = myString[nextIndex]
Range Expressions
var s = myString.Substring[0..2];
var s = myString.Substring(1..^1);
29. RECORDS
That’s it. With just one line of code, we’d get, for free
• A constructor.
• A pair of properties.
• “Equals” and “GetHashCode” overrides.
• An implementation of IEquatable<Move>.
• A “Deconstruct” method
var move = new Move("Alice Doe", MoveStrategy.Rock);
var move2 = new Move("Alice Doe", MoveStrategy.Rock);
Assert.AreEqual(move, move2);
30. class Shape { }
class Triangle : Shape { }
class Pentagon : Shape { }
public int A(Shape shape)
{
return shape switch {
Triangle u => 3, Pentagon b => 5
}
}
DISCRIMINATED UNIONS
34. DICTIONARY LITERALS
var x = new Dictionary<string, int>() { { "foo", 4 }, { "bar", 5 } };
var y = new Dictionary<string, int>() { ["foo"] = 4, ["bar"] = 5 };
var z = ["foo":4, "bar": 5];