SlideShare ist ein Scribd-Unternehmen logo
1 von 21
C# Today &
Tomorrow
http://stackoverflow.com/research/developer-survey-2015
http://stackoverflow.com/research/developer-survey-2015
http://stackoverflow.com/research/developer-survey-2015
Changing our tune…
Run on Windows
.NET as system component
Run on VM (CLR)
Black box compilers
Edit in Visual Studio
Proprietary
Run everywhere
Deploy with app
Compile to native
Open compiler APIs
Use your favorite editor
Open source
Project Roslyn
“Let’s rewrite the C# and VB compilers and IDE
from scratch!”
• Evolve
• Enable
• Dogfood
The compiler/IDE dichotomy
Compiler
Batch
Throughput
Correctness
Prevent badness
Reactive to what you did
IDE
Incremental
Responsiveness
Error tolerance
Enable goodness
Predictive of what you will do
The Roslyn Compiler API
There should only need to be
one code base in the world
for understanding C#
Other IDEs On other platforms
Custom diagnostics Style, API usage, patterns…
Source transformation Refactorings, fixers, migraters, updaters…
Scripting Batch scripts, hosted code…
Coding in execution REPL, edit-and-continue…
Documentation Hyperlinked API docs, web playgrounds…
Static analysis Code metrics, graphs, telemetry, code querying…
Metaprogramming Source generators, injectors, weavers…
Other language understanding scenarios
Custom analyzers and fixes
Plug in to diagnostic reporting and code fixing
infrastructure
Batch and interactive
“Code-aware libraries”
APIs can ship with analyzers and fixes to guide their users
Toolboxes
Style enforcement, discovery of opportunities
Language evolution explained
Stagnation
C#
Evolution of C#
C# 1
Hello World
C# 2
Generics
C# 3
Queries,
Lambdas
C# 4
Dynamic,
Concurrency
C# 5
Async
C# 6
Avoid
boilerplate
C# 7
???
Demo: REPL and C# 6
C# “7”
Pattern matching
if (o is Point p) { WriteLine($"({p.X}, {p.Y})"); }
if (o is Point p && p.X == 5) { WriteLine($"Y: {p.Y}"); }
if (o is Point(5, var y)) { WriteLine($"Y: {y}"); }
Patterns in switch statements
switch (o)
{
case int i:
WriteLine($"Number {i}");
break;
case Point(int x, int y):
WriteLine($"({x},{y})");
break;
case string s when s.Length > 0:
WriteLine(s);
break;
case null:
WriteLine("<null>");
break;
default:
WriteLine("<other>");
break;
}
Tuples
public (int sum, int count) Tally(IEnumerable<int> values)
{
var s = 0; var c = 0;
foreach (var value in values) { s += value; c++; }
return (s, c);
}
var t = Tally(myValues);
Console.WriteLine($"Sum: {t.sum}, count: {t.count}");
(var s, var c) = Tally(myValues);
Console.WriteLine($"Sum: {s}, count: {c}");
Records
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 (string First, string Last) Deconstruct() => (First, Last);
public bool Equals(Person other) => 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);
…
}
class Person(string First, string Last);
Creating immutable objects
var p1 = new Point { X = 3, Y = 7 };
var p2 = p1 with { X = -p1.X };
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!
?

Weitere ähnliche Inhalte

Was ist angesagt?

2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - englishJen Yee Hong
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersJen Yee Hong
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scalaRuslan Shevchenko
 
DaNode - A home made web server in D
DaNode - A home made web server in DDaNode - A home made web server in D
DaNode - A home made web server in DAndrei Alexandrescu
 
F#语言对异步程序设计的支持
F#语言对异步程序设计的支持F#语言对异步程序设计的支持
F#语言对异步程序设计的支持jeffz
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate CompilersFunctional Thursday
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronouskang taehun
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)Olve Maudal
 
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17LogeekNightUkraine
 
C Sharp Lecture Johan Franzen
C Sharp Lecture  Johan FranzenC Sharp Lecture  Johan Franzen
C Sharp Lecture Johan Franzeng_hemanth17
 
DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright Andrei Alexandrescu
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Oleg Zinchenko
 
Connecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with EmbindConnecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with EmbindChad Austin
 
Emscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsEmscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsLuka Zakrajšek
 

Was ist angesagt? (20)

MFC Message Handling
MFC Message HandlingMFC Message Handling
MFC Message Handling
 
Let's Go-lang
Let's Go-langLet's Go-lang
Let's Go-lang
 
2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english2018 cosup-delete unused python code safely - english
2018 cosup-delete unused python code safely - english
 
Csp scala wixmeetup2016
Csp scala wixmeetup2016Csp scala wixmeetup2016
Csp scala wixmeetup2016
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
 
DaNode - A home made web server in D
DaNode - A home made web server in DDaNode - A home made web server in D
DaNode - A home made web server in D
 
F#语言对异步程序设计的支持
F#语言对异步程序设计的支持F#语言对异步程序设计的支持
F#语言对异步程序设计的支持
 
Oro meetup #4
Oro meetup #4Oro meetup #4
Oro meetup #4
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronous
 
C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)C++ idioms by example (Nov 2008)
C++ idioms by example (Nov 2008)
 
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
Vladymyr Bahrii Understanding polymorphism in C++ 16.11.17
 
C Sharp Lecture Johan Franzen
C Sharp Lecture  Johan FranzenC Sharp Lecture  Johan Franzen
C Sharp Lecture Johan Franzen
 
DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)
 
P2
P2P2
P2
 
Connecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with EmbindConnecting C++ and JavaScript on the Web with Embind
Connecting C++ and JavaScript on the Web with Embind
 
Emscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math opsEmscripten, asm.js, and billions of math ops
Emscripten, asm.js, and billions of math ops
 
Typescript is the best
Typescript is the bestTypescript is the best
Typescript is the best
 

Ähnlich wie C# Today and Tomorrow

(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...Phil Calçado
 
C# What's next? (7.x and 8.0)
C# What's next? (7.x and 8.0)C# What's next? (7.x and 8.0)
C# What's next? (7.x and 8.0)Christian Nagel
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr-archana-dhawan-bajaj
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Chris Adamson
 
Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chhom Karath
 
Functional Principles for OO Developers
Functional Principles for OO DevelopersFunctional Principles for OO Developers
Functional Principles for OO Developersjessitron
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsJigar Gosar
 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8Christian Nagel
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practicesIwan van der Kleijn
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기경주 전
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...Sang Don Kim
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Abou Bakr Ashraf
 
Roslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesRoslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesMichael Step
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.pptpsundarau
 

Ähnlich wie C# Today and Tomorrow (20)

Effective Object Oriented Design in Cpp
Effective Object Oriented Design in CppEffective Object Oriented Design in Cpp
Effective Object Oriented Design in Cpp
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 
C# What's next? (7.x and 8.0)
C# What's next? (7.x and 8.0)C# What's next? (7.x and 8.0)
C# What's next? (7.x and 8.0)
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slides
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
 
XAML/C# to HTML/JS
XAML/C# to HTML/JSXAML/C# to HTML/JS
XAML/C# to HTML/JS
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Chapter i c#(console application and programming)
Chapter i c#(console application and programming)Chapter i c#(console application and programming)
Chapter i c#(console application and programming)
 
Novidades do c# 7 e 8
Novidades do c# 7 e 8Novidades do c# 7 e 8
Novidades do c# 7 e 8
 
Functional Principles for OO Developers
Functional Principles for OO DevelopersFunctional Principles for OO Developers
Functional Principles for OO Developers
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 
Dr archana dhawan bajaj - c# dot net
Dr archana dhawan bajaj - c# dot netDr archana dhawan bajaj - c# dot net
Dr archana dhawan bajaj - c# dot net
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2
 
Roslyn and C# 6.0 New Features
Roslyn and C# 6.0 New FeaturesRoslyn and C# 6.0 New Features
Roslyn and C# 6.0 New Features
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.ppt
 

Mehr von Bertrand Le Roy

Orchard 2... and why you should care
Orchard 2... and why you should careOrchard 2... and why you should care
Orchard 2... and why you should careBertrand Le Roy
 
Orchard Harvest Keynote 2015 - the CMS of the future
Orchard Harvest Keynote 2015 - the CMS of the futureOrchard Harvest Keynote 2015 - the CMS of the future
Orchard Harvest Keynote 2015 - the CMS of the futureBertrand Le Roy
 
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013Bertrand Le Roy
 
Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Bertrand Le Roy
 
Orchard Harvest Amsterdam 2013 Keynote
Orchard Harvest Amsterdam 2013 KeynoteOrchard Harvest Amsterdam 2013 Keynote
Orchard Harvest Amsterdam 2013 KeynoteBertrand Le Roy
 

Mehr von Bertrand Le Roy (7)

Next .NET and C#
Next .NET and C#Next .NET and C#
Next .NET and C#
 
Orchard 2... and why you should care
Orchard 2... and why you should careOrchard 2... and why you should care
Orchard 2... and why you should care
 
.Net Core
.Net Core.Net Core
.Net Core
 
Orchard Harvest Keynote 2015 - the CMS of the future
Orchard Harvest Keynote 2015 - the CMS of the futureOrchard Harvest Keynote 2015 - the CMS of the future
Orchard Harvest Keynote 2015 - the CMS of the future
 
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
Best kept Orchard recipes - Orchard Harvest Amsterdam 2013
 
Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013Commerce - Orchard Harvest Amsterdam 2013
Commerce - Orchard Harvest Amsterdam 2013
 
Orchard Harvest Amsterdam 2013 Keynote
Orchard Harvest Amsterdam 2013 KeynoteOrchard Harvest Amsterdam 2013 Keynote
Orchard Harvest Amsterdam 2013 Keynote
 

Kürzlich hochgeladen

The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Kürzlich hochgeladen (20)

The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

C# Today and Tomorrow

  • 5. Changing our tune… Run on Windows .NET as system component Run on VM (CLR) Black box compilers Edit in Visual Studio Proprietary Run everywhere Deploy with app Compile to native Open compiler APIs Use your favorite editor Open source
  • 6. Project Roslyn “Let’s rewrite the C# and VB compilers and IDE from scratch!” • Evolve • Enable • Dogfood
  • 7. The compiler/IDE dichotomy Compiler Batch Throughput Correctness Prevent badness Reactive to what you did IDE Incremental Responsiveness Error tolerance Enable goodness Predictive of what you will do
  • 8. The Roslyn Compiler API There should only need to be one code base in the world for understanding C#
  • 9. Other IDEs On other platforms Custom diagnostics Style, API usage, patterns… Source transformation Refactorings, fixers, migraters, updaters… Scripting Batch scripts, hosted code… Coding in execution REPL, edit-and-continue… Documentation Hyperlinked API docs, web playgrounds… Static analysis Code metrics, graphs, telemetry, code querying… Metaprogramming Source generators, injectors, weavers… Other language understanding scenarios
  • 10. Custom analyzers and fixes Plug in to diagnostic reporting and code fixing infrastructure Batch and interactive “Code-aware libraries” APIs can ship with analyzers and fixes to guide their users Toolboxes Style enforcement, discovery of opportunities
  • 12. Evolution of C# C# 1 Hello World C# 2 Generics C# 3 Queries, Lambdas C# 4 Dynamic, Concurrency C# 5 Async C# 6 Avoid boilerplate C# 7 ???
  • 15. Pattern matching if (o is Point p) { WriteLine($"({p.X}, {p.Y})"); } if (o is Point p && p.X == 5) { WriteLine($"Y: {p.Y}"); } if (o is Point(5, var y)) { WriteLine($"Y: {y}"); }
  • 16. Patterns in switch statements switch (o) { case int i: WriteLine($"Number {i}"); break; case Point(int x, int y): WriteLine($"({x},{y})"); break; case string s when s.Length > 0: WriteLine(s); break; case null: WriteLine("<null>"); break; default: WriteLine("<other>"); break; }
  • 17. Tuples public (int sum, int count) Tally(IEnumerable<int> values) { var s = 0; var c = 0; foreach (var value in values) { s += value; c++; } return (s, c); } var t = Tally(myValues); Console.WriteLine($"Sum: {t.sum}, count: {t.count}"); (var s, var c) = Tally(myValues); Console.WriteLine($"Sum: {s}, count: {c}");
  • 18. Records 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 (string First, string Last) Deconstruct() => (First, Last); public bool Equals(Person other) => 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); … } class Person(string First, string Last);
  • 19. Creating immutable objects var p1 = new Point { X = 3, Y = 7 }; var p2 = p1 with { X = -p1.X };
  • 20. 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!
  • 21. ?

Hinweis der Redaktion

  1. Evolve: it’s now easier to evolve the languages Enable: it enables a whole ecosystem of code analysis, refactoring tools, and tools that act on code Dogfood: we can roll out new language features and tooling to early adopters for feedback without having to ship VS or compilers
  2. Pace of innovation is not necessarily whenever you get an idea. There’s such a thing as an innovation that comes too soon. The evolution comparison is also interesting because it’s the environment that drives innovation, not random mutations. Horseshoe crab picture by Didier Descouens (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons Saddleback caterpillar picture by Mary Keim https://www.flickr.com/photos/38514062@N03/9410316517/in/photolist-fkykfv-fkyk58-fpYfpv https://creativecommons.org/licenses/by-nc-sa/2.0/
  3. Launch VS, open REPL (view/other windows/c# interactive) 2+2, Console.WriteLine(“Hello SpaceX”) – Remember, Alt+up arrow to copy a previous statement. CTRL+Enter to execute no matter where the cursor is. using static System.Console; Console.WriteLine(“Hello SpaceX”) <- Roslyn tells you what became unnecessary. Hover to see recommendation. Remove “Console” Interpolating strings should be easy: Add the $ in front of the string, and start introducing expressions: {2016} at the end of the string. Replace expression with {2015+1} Make it reusable next year by writing {DateTime.Now.Year} You can also declare variables in the REPL: var awesomeCompany = “SpaceX”; and then replace the static string. Let’s define a method now: take the previsous code and change it to: string Greeting() {return $”Hello {awesomeCompany} {DateTime.Now.Year}”;} then call Greeting() Change it to a expression-bodied function: string Greeting() => $"Hello { awesomeCompany} { DateTime.Now.Year}"; Let’s look at other C#6 features. First, auto-property initializers: public class Person { public string FirstName { get; } = "Brett"; } new Person().FirstName You can also set such properties from a constructor, which is nice as it removes the need for a private setter that you never don’t need. You can replace the property definition with public string FirstName => "Brett"; Add the following members to the class to introduce the null-coalesce operator: public string LastName { get; set; } public string Initials => FirstName?[0].ToString() + LastName?[0].ToString(); then do new Person().Initials then new Person { LastName = "Morrison" }.Initials We have a new operator that can make a lot of refactoring scenarios more robust: nameof nameof(Person) string Greeting(string awesomeCompany) => $"Hello {nameof(awesomeCompany)} { awesomeCompany } { DateTime.Now.Year }"; Refactoring is going to work inside string interpolation. Index initializers: var numbers = new Dictionary<int, string> { [1] = "One", [42] = "Forty-two“ }; numbers[42] Other C#6 features include await in catch blocks, and “when” conditions on catch.
  4. Closest current equivalent code is var p = o as Point; if (p != null) {… but that gives p too large a scope.
  5. Alternative today is to declare a small class, or have out parameters. The syntax is designed to mirror that of function arguments.
  6. String! Could have been another solution, but would have implied that non-nullable is the exception. Having string? makes nullable strings the exception, as it should have been from the start, but enforcing string without qualifiers to be non-nullable would have been far too breaking. In the end, emitting warnings for failures to check for null is a good compromise as it encourages the right behavior without breaking existing code.