SlideShare a Scribd company logo
What’s next for .NET Core and C#
Bertrand Le Roy
Agenda
• Tooling
• .NET Standard
• C#
.NET Core everywhere
• Windows
• macOS
• Ubuntu, Debian, CentOS, RHEL, openSUSE, Fedora, …
• Docker
• X86, x64, ARM
Tooling
• Visual Studio 2017
• OmniSharp: VS Code, vim, emacs, Sublime, etc.
• Visual Studio for Mac
• JetBrains Rider
• CLI: x-plat, focused on building code for both humans and
machines…
Project system
• project.json will be gone for good with the 1.0 of the tooling
• New and improved csproj
• Small
• Easy to manually edit
• Globs – easier merges!
• No GUIDs
• Lower concept count
• Integrated package references
• Easily migrated from project.json
• One project system to rule Xamarin, Mono, .NET Core, .NET Framework
• All the power of MSBuild
Default console app template…
… with a package
Default library template
Introducing the SDK
• Contains all the tasks and targets for working with Core code
• Shared between CLI, Visual Studio, Visual Studio for Mac, VS
Code (OmniSharp)
Shared SDK component
Visual Studio VS Code
.NET Core
Command Line
tools
CLI commands
dotnet build --output [path]
the driver verb (command) verb arguments
Core commands
• dotnet new
• dotnet restore
• dotnet run
• dotnet build
• dotnet publish
• dotnet pack
• dotnet test
CRUD & advanced commands
• dotnet add/list/remove reference
• dotnet add/list/remove package
• dotnet sln add/list/remove
• dotnet msbuild
• dotnet nuget
• dotnet vstest
• … and your own commands, distributed as NuGet packages or
added to the path
.NET before .NET Standard
Compilers Languages Runtime components
COMMON INFRASTRUCTURE
.NET before .NET Standard
Compilers Languages Runtime components
COMMON INFRASTRUCTURE
.NET after .NET Standard
Compilers Languages Runtime components
COMMON INFRASTRUCTURE
.NET after .NET Standard
Compilers Languages Runtime components
COMMON INFRASTRUCTURE
What is .NET Standard?
• A spec: .NET Standard is to .NET what POSIX is to Unix
public class DotNetCore : IDotNetStandard { … }
• A set of APIs that all .NET platforms have to implement
• A class library provided as a NuGet package that provides the
façade that .NET code can compile against
Versioning .NET Standard
• Higher version incorporates all
previous
• Concrete .NET platforms
implement a specific version of
the standard, and can run all
code targeting versions up to
that number
2.0
1.6
1.3
1.0
What’s new in .NET Standard 2.0?
• More than double the APIs
• Compatibility with .NET Framework libraries: your code may
already be cross-platform…
Version #APIs Growth %
1.6 13,501
2.0 32,638 +142%
APIs in .NET Standard 2.0
Primitives • Collections • Reflection • Interop • LinqCORE
Threads • Thread Pool • TasksTHREADING
Files • Compression • MMFIO
Sockets • Http • Mail • WebSocketsNETWORKING
BinaryFormatter • Data Contract • XMLSERIALIZATION
XLinq • XML Document • XPath • Schema • XSLXML
Abstractions • Provider Model • DataSetDATA
http://apisof.net
http://stackoverflow.com/research/developer-survey-2016#technology-most-popular-technologies
Most “popular” technologies
http://stackoverflow.com/research/developer-survey-2016#technology-most-loved-dreaded-and-wanted
Most “loved” technologies
C# - State of the Union
C#
1,000,000’s
Millions
C# 7.0 recap
static void Main(string[] args)
{
object[] numbers =
{ 0b1, 0b10, new object[] { 0b100, 0b1000 }, // binary literals
0b1_0000, 0b10_0000 }; // digit separators
var (sum, count) = Tally(numbers); // deconstruction
WriteLine($"Sum: {sum}, Count: {count}");
}
C# 7.0 recap
static (int sum, int count) Tally(object[] values) // tuple types
{
var r = (s: 0, c: 0); // tuple literals
void Add(int s, int c) { r.s += s, r.c += c; } // local functions
foreach (var v in values)
{
switch (v) // switch on any value
{
case int i: // type patterns
Add(i, 1);
break;
case object[] a when a.Length > 0: // case conditions
var t = Tally(a);
Add(t.sum, t.count);
break;
}
}
return r;
}
What’s ahead
Many ideas, and some stand out as clearly worthwhile
Smaller, more frequent language versions that are opt-in for the cutting edge
Major features requiring framework or runtime evolution
Design tenets
The language embraces new concepts
Common paths become easier
Code runs faster or uses less memory
Bugs are prevented
Recursive patterns
if (o is Point(_, var y)) { WriteLine($"Y: {y}"); }
if (o is Point { Y: var y }) { WriteLine($"Y: {y}"); }
Pattern matching expressions
var s = match (o)
{
int i => $"Number {i}",
case Point(int x, int y) => $"({x},{y})",
string s when s.Length > 0 => s,
null => "<null>",
_ => "<other>"
};
Tuples in patterns
state = match (state, request)
{
(Closed, Open) => Opened,
(Closed, Lock) => Locked,
(Opened, Close) => Closed,
(Locked, Unlock) => Closed,
_ => throw new InvalidOperationException(…)
}
Nullable and non-nullable reference types
string? n; // Nullable reference type
string s; // Non-nullable reference type
n = null; // Sure; it's nullable
s = null; // Warning! Shouldn’t be null!
s = n; // Warning! Really!
WriteLine(s.Length); // Sure; it’s not null
WriteLine(n.Length); // Warning! Could be null!
if (n != null) { WriteLine(n.Length); } // Sure; you checked
WriteLine(n!.Length); // Ok, if you insist!
Async streams and disposables
IAsyncEnumerable<Person> people = database.GetPeopleAsync();
foreach await (var person in people)
{
// use person
}
using await (IAsyncDisposable resource = await store.GetRecordAsync(…))
{
// use resource
}
Default implementations
public interface IEnumerator
{
object Current { get; }
bool MoveNext();
void Reset() => throw new InvalidOperationException("Reset not supported");
}
public interface IEnumerator<out T> : IDisposable, IEnumerator
{
new T Current { get; }
object IEnumerator.Current => Current;
}
Records and discriminated unions
class Person : IEquatable<Person>
{
public string First { get; }
public string Last { get; }
public Person(string First, string Last)
{
this.First = First; this.Last = Last;
}
public void Deconstruct(out string first, out string last)
{
first = First; last = Last;
}
public bool Equals(Person other) => other != null && First == other.First && Last == other.Last;
public override bool Equals(object obj) => obj is Person other ? Equals(other) : false;
public override int GetHashCode() => GreatHashFunction(First, Last);
…
}
record Person(string First, string Last);
Primary constructors
public class AccountController(
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
ILogger<AccountController> logger) : Controller()
{
public UserManager<ApplicationUser> UserManager => userManager;
public SignInManager<ApplicationUser> SignInManager => signInManager;
///...
}
Creating immutable objects
var p1 = new Point { X = 3, Y = 7 };
var p2 = p1 with { X = -p1.X };
Extension everything
extension Enrollee extends Person
{
// static field
static Dictionary<Person, Professor> enrollees = new();
// instance method
public void Enroll(Professor supervisor) { enrollees[this] = supervisor; }
// instance property
public Professor Supervisor => enrollees.TryGetValue(this, out var supervisor) ? supervisor : null;
// static property
public static ICollection<Person> Students => enrollees.Keys;
// instance constructor
public Person(string name, Professor supervisor) : this(name) { this.Enroll(supervisor); }
}
Questions?

More Related Content

What's hot (20)

PDF
Crystal internals (part 1)
Ary Borenszweig
 
PDF
Crystal presentation in NY
Crystal Language
 
ODP
Ppt of c vs c#
shubhra chauhan
 
PDF
C# / Java Language Comparison
Robert Bachmann
 
ODP
The D Programming Language - Why I love it!
ryutenchi
 
PPTX
C# Tutorial
Jm Ramos
 
PPT
Language processor implementation using python
Viktor Pyskunov
 
PDF
Functional Programming in C# and F#
Alfonso Garcia-Caro
 
PPTX
C++ vs C#
sudipv
 
PPTX
Go Programming Language (Golang)
Ishin Vin
 
PDF
Développer un moteur d'exécution symbolique en partant de rien
JUG Lausanne
 
PDF
C++ Training
SubhendraBasu5
 
PPT
C# Basics
Sunil OS
 
PPT
F# Eye for the C# Guy
gueste3f83d
 
PPT
Visual Studio .NET2010
Satish Verma
 
PDF
Some basic FP concepts
Falko Riemenschneider
 
PPTX
All You Need to Know About Type Script
Folio3 Software
 
PPTX
Pure virtual function and abstract class
Amit Trivedi
 
PPT
Introduction To C#
SAMIR BHOGAYTA
 
Crystal internals (part 1)
Ary Borenszweig
 
Crystal presentation in NY
Crystal Language
 
Ppt of c vs c#
shubhra chauhan
 
C# / Java Language Comparison
Robert Bachmann
 
The D Programming Language - Why I love it!
ryutenchi
 
C# Tutorial
Jm Ramos
 
Language processor implementation using python
Viktor Pyskunov
 
Functional Programming in C# and F#
Alfonso Garcia-Caro
 
C++ vs C#
sudipv
 
Go Programming Language (Golang)
Ishin Vin
 
Développer un moteur d'exécution symbolique en partant de rien
JUG Lausanne
 
C++ Training
SubhendraBasu5
 
C# Basics
Sunil OS
 
F# Eye for the C# Guy
gueste3f83d
 
Visual Studio .NET2010
Satish Verma
 
Some basic FP concepts
Falko Riemenschneider
 
All You Need to Know About Type Script
Folio3 Software
 
Pure virtual function and abstract class
Amit Trivedi
 
Introduction To C#
SAMIR BHOGAYTA
 

Similar to Next .NET and C# (20)

PPTX
.NET Foundation, Future of .NET and C#
Bertrand Le Roy
 
PDF
Introduction to dot net
QIANG XU
 
PPTX
What's coming to c# (Tel-Aviv, 2018)
Moaid Hathot
 
PPT
David buksbaum a-briefintroductiontocsharp
Jorge Antonio Contre Vargas
 
PDF
Dot NET Core Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
The ultimate cheat sheet on .net core, .net framework, and .net standard
Concetto Labs
 
PPTX
What’s new in .NET
Doommaker
 
PPTX
C#: Past, Present and Future
Rodolfo Finochietti
 
PDF
C# 10 in a Nutshell_ The Definitive Reference-O'Reilly Media (2022).pdf
ssuser2a88da1
 
PDF
Net In Action Second Edition Meap V06 2nd Chapters 1 To 12 Of 13 Dustin Metzgar
barbeondik5c
 
PPTX
Mini .net conf 2020
Marco Parenzan
 
PPTX
Introduction to .NET with C# @ university of wayamba
Prageeth Sandakalum
 
PDF
Introduction to C3.net Architecture unit
Kotresh Munavallimatt
 
PDF
Raffaele Rialdi
CodeFest
 
PDF
1..Net Framework Architecture-(c#)
Shoaib Ghachi
 
PDF
.NET Core Blimey! (Shropshire Devs Mar 2016)
citizenmatt
 
PDF
.NET Core Blimey! Windows Platform User Group, Manchester
citizenmatt
 
PPTX
Overview of the new .NET Core and .NET Platform Standard
Alex Thissen
 
PDF
Whats new in .NET for 2019
Rory Preddy
 
PDF
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
citizenmatt
 
.NET Foundation, Future of .NET and C#
Bertrand Le Roy
 
Introduction to dot net
QIANG XU
 
What's coming to c# (Tel-Aviv, 2018)
Moaid Hathot
 
David buksbaum a-briefintroductiontocsharp
Jorge Antonio Contre Vargas
 
Dot NET Core Interview Questions PDF By ScholarHat
Scholarhat
 
The ultimate cheat sheet on .net core, .net framework, and .net standard
Concetto Labs
 
What’s new in .NET
Doommaker
 
C#: Past, Present and Future
Rodolfo Finochietti
 
C# 10 in a Nutshell_ The Definitive Reference-O'Reilly Media (2022).pdf
ssuser2a88da1
 
Net In Action Second Edition Meap V06 2nd Chapters 1 To 12 Of 13 Dustin Metzgar
barbeondik5c
 
Mini .net conf 2020
Marco Parenzan
 
Introduction to .NET with C# @ university of wayamba
Prageeth Sandakalum
 
Introduction to C3.net Architecture unit
Kotresh Munavallimatt
 
Raffaele Rialdi
CodeFest
 
1..Net Framework Architecture-(c#)
Shoaib Ghachi
 
.NET Core Blimey! (Shropshire Devs Mar 2016)
citizenmatt
 
.NET Core Blimey! Windows Platform User Group, Manchester
citizenmatt
 
Overview of the new .NET Core and .NET Platform Standard
Alex Thissen
 
Whats new in .NET for 2019
Rory Preddy
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
citizenmatt
 
Ad

More from Bertrand Le Roy (7)

PPTX
Orchard 2... and why you should care
Bertrand Le Roy
 
PPTX
C# Today and Tomorrow
Bertrand Le Roy
 
PPTX
.Net Core
Bertrand Le Roy
 
PPTX
Orchard Harvest Keynote 2015 - the CMS of the future
Bertrand Le Roy
 
PPTX
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Bertrand Le Roy
 
PPTX
Commerce - Orchard Harvest Amsterdam 2013
Bertrand Le Roy
 
PPTX
Orchard Harvest Amsterdam 2013 Keynote
Bertrand Le Roy
 
Orchard 2... and why you should care
Bertrand Le Roy
 
C# Today and Tomorrow
Bertrand Le Roy
 
.Net Core
Bertrand Le Roy
 
Orchard Harvest Keynote 2015 - the CMS of the future
Bertrand Le Roy
 
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Bertrand Le Roy
 
Commerce - Orchard Harvest Amsterdam 2013
Bertrand Le Roy
 
Orchard Harvest Amsterdam 2013 Keynote
Bertrand Le Roy
 
Ad

Recently uploaded (20)

PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Executive Business Intelligence Dashboards
vandeslie24
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Import Data Form Excel to Tally Services
Tally xperts
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 

Next .NET and C#

  • 1. What’s next for .NET Core and C# Bertrand Le Roy
  • 2. Agenda • Tooling • .NET Standard • C#
  • 3. .NET Core everywhere • Windows • macOS • Ubuntu, Debian, CentOS, RHEL, openSUSE, Fedora, … • Docker • X86, x64, ARM
  • 4. Tooling • Visual Studio 2017 • OmniSharp: VS Code, vim, emacs, Sublime, etc. • Visual Studio for Mac • JetBrains Rider • CLI: x-plat, focused on building code for both humans and machines…
  • 5. Project system • project.json will be gone for good with the 1.0 of the tooling • New and improved csproj • Small • Easy to manually edit • Globs – easier merges! • No GUIDs • Lower concept count • Integrated package references • Easily migrated from project.json • One project system to rule Xamarin, Mono, .NET Core, .NET Framework • All the power of MSBuild
  • 6. Default console app template…
  • 7. … with a package
  • 9. Introducing the SDK • Contains all the tasks and targets for working with Core code • Shared between CLI, Visual Studio, Visual Studio for Mac, VS Code (OmniSharp) Shared SDK component Visual Studio VS Code .NET Core Command Line tools
  • 10. CLI commands dotnet build --output [path] the driver verb (command) verb arguments
  • 11. Core commands • dotnet new • dotnet restore • dotnet run • dotnet build • dotnet publish • dotnet pack • dotnet test
  • 12. CRUD & advanced commands • dotnet add/list/remove reference • dotnet add/list/remove package • dotnet sln add/list/remove • dotnet msbuild • dotnet nuget • dotnet vstest • … and your own commands, distributed as NuGet packages or added to the path
  • 13. .NET before .NET Standard Compilers Languages Runtime components COMMON INFRASTRUCTURE
  • 14. .NET before .NET Standard Compilers Languages Runtime components COMMON INFRASTRUCTURE
  • 15. .NET after .NET Standard Compilers Languages Runtime components COMMON INFRASTRUCTURE
  • 16. .NET after .NET Standard Compilers Languages Runtime components COMMON INFRASTRUCTURE
  • 17. What is .NET Standard? • A spec: .NET Standard is to .NET what POSIX is to Unix public class DotNetCore : IDotNetStandard { … } • A set of APIs that all .NET platforms have to implement • A class library provided as a NuGet package that provides the façade that .NET code can compile against
  • 18. Versioning .NET Standard • Higher version incorporates all previous • Concrete .NET platforms implement a specific version of the standard, and can run all code targeting versions up to that number 2.0 1.6 1.3 1.0
  • 19. What’s new in .NET Standard 2.0? • More than double the APIs • Compatibility with .NET Framework libraries: your code may already be cross-platform… Version #APIs Growth % 1.6 13,501 2.0 32,638 +142%
  • 20. APIs in .NET Standard 2.0 Primitives • Collections • Reflection • Interop • LinqCORE Threads • Thread Pool • TasksTHREADING Files • Compression • MMFIO Sockets • Http • Mail • WebSocketsNETWORKING BinaryFormatter • Data Contract • XMLSERIALIZATION XLinq • XML Document • XPath • Schema • XSLXML Abstractions • Provider Model • DataSetDATA http://apisof.net
  • 23. C# - State of the Union C# 1,000,000’s Millions
  • 24. C# 7.0 recap static void Main(string[] args) { object[] numbers = { 0b1, 0b10, new object[] { 0b100, 0b1000 }, // binary literals 0b1_0000, 0b10_0000 }; // digit separators var (sum, count) = Tally(numbers); // deconstruction WriteLine($"Sum: {sum}, Count: {count}"); }
  • 25. C# 7.0 recap static (int sum, int count) Tally(object[] values) // tuple types { var r = (s: 0, c: 0); // tuple literals void Add(int s, int c) { r.s += s, r.c += c; } // local functions foreach (var v in values) { switch (v) // switch on any value { case int i: // type patterns Add(i, 1); break; case object[] a when a.Length > 0: // case conditions var t = Tally(a); Add(t.sum, t.count); break; } } return r; }
  • 26. What’s ahead Many ideas, and some stand out as clearly worthwhile Smaller, more frequent language versions that are opt-in for the cutting edge Major features requiring framework or runtime evolution
  • 27. Design tenets The language embraces new concepts Common paths become easier Code runs faster or uses less memory Bugs are prevented
  • 28. Recursive patterns if (o is Point(_, var y)) { WriteLine($"Y: {y}"); } if (o is Point { Y: var y }) { WriteLine($"Y: {y}"); }
  • 29. Pattern matching expressions var s = match (o) { int i => $"Number {i}", case Point(int x, int y) => $"({x},{y})", string s when s.Length > 0 => s, null => "<null>", _ => "<other>" };
  • 30. Tuples in patterns state = match (state, request) { (Closed, Open) => Opened, (Closed, Lock) => Locked, (Opened, Close) => Closed, (Locked, Unlock) => Closed, _ => throw new InvalidOperationException(…) }
  • 31. Nullable and non-nullable reference types string? n; // Nullable reference type string s; // Non-nullable reference type n = null; // Sure; it's nullable s = null; // Warning! Shouldn’t be null! s = n; // Warning! Really! WriteLine(s.Length); // Sure; it’s not null WriteLine(n.Length); // Warning! Could be null! if (n != null) { WriteLine(n.Length); } // Sure; you checked WriteLine(n!.Length); // Ok, if you insist!
  • 32. Async streams and disposables IAsyncEnumerable<Person> people = database.GetPeopleAsync(); foreach await (var person in people) { // use person } using await (IAsyncDisposable resource = await store.GetRecordAsync(…)) { // use resource }
  • 33. Default implementations public interface IEnumerator { object Current { get; } bool MoveNext(); void Reset() => throw new InvalidOperationException("Reset not supported"); } public interface IEnumerator<out T> : IDisposable, IEnumerator { new T Current { get; } object IEnumerator.Current => Current; }
  • 34. Records and discriminated unions class Person : IEquatable<Person> { public string First { get; } public string Last { get; } public Person(string First, string Last) { this.First = First; this.Last = Last; } public void Deconstruct(out string first, out string last) { first = First; last = Last; } public bool Equals(Person other) => other != null && First == other.First && Last == other.Last; public override bool Equals(object obj) => obj is Person other ? Equals(other) : false; public override int GetHashCode() => GreatHashFunction(First, Last); … } record Person(string First, string Last);
  • 35. Primary constructors public class AccountController( UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILogger<AccountController> logger) : Controller() { public UserManager<ApplicationUser> UserManager => userManager; public SignInManager<ApplicationUser> SignInManager => signInManager; ///... }
  • 36. Creating immutable objects var p1 = new Point { X = 3, Y = 7 }; var p2 = p1 with { X = -p1.X };
  • 37. Extension everything extension Enrollee extends Person { // static field static Dictionary<Person, Professor> enrollees = new(); // instance method public void Enroll(Professor supervisor) { enrollees[this] = supervisor; } // instance property public Professor Supervisor => enrollees.TryGetValue(this, out var supervisor) ? supervisor : null; // static property public static ICollection<Person> Students => enrollees.Keys; // instance constructor public Person(string name, Professor supervisor) : this(name) { this.Enroll(supervisor); } }