SlideShare uma empresa Scribd logo
1 de 27
PRESENTS
Coimbatore, Tamil Nadu, India Dec 22, 2018
Brought to you by
Microsoft Connect(); 2018 - Local Event
Muralidharan Deenathayalan
Technical Architect at Quanticate
What's New in C# 8.0
Brought to you by
• C# - A quick definition
• Evolution history of C#
• New features of C# 8.0
• Demo
• How I can learn more?
• Q & A
• Reference links
2
Agenda
Brought to you by
• Nullable reference type
• Implicitly-typed new-expressions
• Ranges and indices
• Default implementations of interface members
• Recursive patterns
• Switch expressions
• Asynchronous streams
3
New features of C# 8.0
Brought to you by
4
C# - A quick definition
Brought to you by
5
Evolution history of C#
C# Version .net Fx Version Visual Studio Version Date
1.0 NET Framework 1.0 Visual Studio .NET 2002 January 2002
1.1, 1.2 .NET Framework 1.1 Visual Studio .NET 2003 April 2003
C# 2.0 .NET Framework 2.0 Visual Studio 2005 November 2005
C# 3.0 .NET Framework 3.0 Visual Studio 2008 November 2006
C# 3.5 .NET Framework 3.5 Visual Studio 2010 November 2007
C# 4.0 .NET Framework 4 Visual Studio 2010 April 2010
C# 5.0 .NET Framework 4.5 Visual Studio 2012
Visual Studio 2013
August 2012
C# 6.0 .NET Framework 4.6 Visual Studio 2015 July 2015
C# 7.0 .NET Framework 4.6.2 Visual Studio 2017 March 2017
C# 7.1 .NET Framework 4.7 Visual Studio 2017 v 15.3 August 2017
C# 7.2 .NET Framework 4.7.1 Visual Studio 2017 v 15.5 November 2017
C# 7.3 .NET Framework 4.7.2 Visual Studio 2017 v 15.7 May 2018
C# 8.0 - beta .NET Framework 4.8 Visual Studio 2019
Brought to you by
• C# variable types: Primitives and Reference types
• Primitive data type
• int, char can’t accept null
• Will have default value of 0 or depends on its data type
• To support, make is nullable like int?
• Ex : int?, char?
• Reference type
• Class etc
• Accepts null
• Default value will be null unless initialized
• Ex: string 6
Nullable reference type
Brought to you by
• Allow developers to express whether a variable, parameter or
result of a reference type is intended to be null or not.
• Provide optional warnings when such variables, parameters and
results are not used according to their intent.
7
Nullable reference type
Brought to you by
• Select C# version to 8.0 (beta)
• Add #nullable enable in the class level
8
Nullable reference type
string myname = null; //will throw warning
Console.WriteLine(myname.Length); //Will throw below warnings
• WarningCS8600 Converting null literal or possible null value to non-nullable type.
• WarningCS8602 Possible dereference of a null reference.
Brought to you by
• Select C# version to 8.0 (beta)
• Add #nullable enable in the class level
Converting to nullable as below.
9
Nullable reference type
string? myname = null; //will throw warning
Console.WriteLine(myname.Length); //Will throw below warnings
• WarningCS8602 Possible dereference of a null reference.
Brought to you by
To avoid this warning, add null check
10
Nullable reference type
string? myname = null;
if (myName != null)
Console.WriteLine(myName.Length);
else
Console.WriteLine(0);
Brought to you by
11
Implicitly-typed new-expressions
Author[] authors =
{
new Author("William", "Shakespeare"),
new Author("John", " Ford")
};
Brought to you by
12
Implicitly-typed new-expressions
Author[] authors =
{
new ("William", "Shakespeare"),
new ("John", " Ford")
};//new Syntax. No need specify the type here
Brought to you by
• Simple syntax for slicing out a part of an array
• New type is called ‘Range’
• Endpoint is exclusive
• new ^ operator, meaning "from end"
• Examples,
• 1..4
• ..1
• 1..
• 1..^2
• ^2..
13
Ranges and indices
Brought to you by
14
Ranges and indices
foreach (var name in names[1..4])
{
Console.WriteLine(name);
} // Getting 1,2 and 3rd element
Range range = 1..4;
foreach (var name in names[range])
{
Console.WriteLine(name);
}//Range variable is used
foreach (var name in names[1..^ 1])
{
Console.WriteLine(name);
}//Starting from 1st element and ending from last 1 element
Brought to you by
• Default interface methods (also known as virtual extension
methods)
• C# Addresses the diamond inheritance problem that can occur
with default interface methods by taking the most specific
override at runtime.
15
Default implementations of interface
members
Brought to you by
16
Default implementations of interface
members
interface IDefaultInterfaceMethod
{
public void DefaultMethod()
{
Console.WriteLine("I am a default method in the interface!");
}
}
class AnyClass : IDefaultInterfaceMethod
{
}
Brought to you by
17
Default implementations of interface
members
IDefaultInterfaceMethod anyClass = new AnyClass();
anyClass.DefaultMethod();
Brought to you by
18
Default implementations of interface
members
AnyClass anyClass = new AnyClass();
anyClass.DefaultMethod(); //compilation error
• AnyClass does not contain a member DefaultMethod.
• That is the proof that the inherited class does not know anything
about the default method.
Brought to you by
19
Recursive patterns
Author author = new Author("William", "Shakespeare");
switch (author.FirstName, author.LastName)
{
case (string fn, string ln):
return $"{fn} {ln} ";
case (string fn, null):
return $"{fn} ";
case (null, ln):
return $"Mr/Mrs {ln} ";
case (null, null):
return $"New author ";
}
Brought to you by
20
Switch expressions
Author author = new Author("William","Shakespeare");
return (author.FirstName, author.LastName) switch
{
(string fn, string ln) => $"{fn} {ln}",
(string fn, null) => $"{ fn}" ,
(null, ln) => $"Mr/Mrs { ln}" ,
(null, null) => $"New author "
};
Brought to you by
• Asynchrous programming techniques provide a way to improve a
program's responsiveness
• Async/Await pattern debuted in C# 5, but is limited to returning a
single scalar value.
• C# 8 adds Async Streams, which allows an async method to return
multiple values
• async Task < int > DoAnythingAsync(). The result of
DoAnythingAsync is an integer (One value).
• Because of this limitation, you cannot use this feature with yield
keyword, and you cannot use it with the async IEnumerable < int >
(which returns an async enumeration).
21
Asynchronous streams
Brought to you by
• async/awaiting feature with a yielding operator = Async Stream
• asynchronous data pull or pull based enumeration or async
sequence in F#
22
Asynchronous streams
Brought to you by
23
Demo
Brought to you by
• https://github.com/dotnet/csharplang/tree/master/proposals
• https://github.com/dotnet/roslyn/blob/master/docs/Language%
20Feature%20Status.md
• https://github.com/dotnet/roslyn
24
How I can learn more?
Brought to you by
25
Q & A
Brought to you by
• https://github.com/dotnet/coreclr/issues/21379 for
IAsyncEnumberable<T>
• https://www.infoq.com/articles/default-interface-methods-cs8
• https://www.infoq.com/articles/cs8-ranges-and-recursive-
patterns
26
References
Brought to you by
27
Keep in touch
Muralidharan Deenathayalan
Blog : www.codingfreaks.net
Github : https://github.com/muralidharand
LinkedIn : https://www.linkedin.com/in/muralidharand
Twitter : https://twitter.com/muralidharand

Mais conteúdo relacionado

Mais procurados

How to Profit from Static Analysis
How to Profit from Static AnalysisHow to Profit from Static Analysis
How to Profit from Static AnalysisElena Laskavaia
 
Functions in C++ (OOP)
Functions in C++ (OOP)Functions in C++ (OOP)
Functions in C++ (OOP)Faizan Janjua
 
JavaScript fundamental data types and functions
JavaScript fundamental data types and functionsJavaScript fundamental data types and functions
JavaScript fundamental data types and functionsAndre Odendaal
 
At Last an OCL Debugger
At Last an OCL DebuggerAt Last an OCL Debugger
At Last an OCL DebuggerEdward Willink
 
Example First / A Sane Test-Driven Approach to Programming
Example First / A Sane Test-Driven Approach to ProgrammingExample First / A Sane Test-Driven Approach to Programming
Example First / A Sane Test-Driven Approach to ProgrammingJonathan Acker
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Timo Stollenwerk
 
History of asynchronous in .NET
History of asynchronous in .NETHistory of asynchronous in .NET
History of asynchronous in .NETMarcin Tyborowski
 
Annotation processor and compiler plugin
Annotation processor and compiler pluginAnnotation processor and compiler plugin
Annotation processor and compiler pluginOleksandr Radchykov
 
Learning C++ - Functions in C++ 3
Learning C++ - Functions  in C++ 3Learning C++ - Functions  in C++ 3
Learning C++ - Functions in C++ 3Ali Aminian
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftOleksandr Stepanov
 
Csc1100 lecture05 ch05
Csc1100 lecture05 ch05Csc1100 lecture05 ch05
Csc1100 lecture05 ch05IIUM
 
TDD and mobile development: some forgotten techniques, illustrated with Android
TDD and mobile development: some forgotten techniques, illustrated with AndroidTDD and mobile development: some forgotten techniques, illustrated with Android
TDD and mobile development: some forgotten techniques, illustrated with AndroidCodemotion
 
Command line arguments that make you smile
Command line arguments that make you smileCommand line arguments that make you smile
Command line arguments that make you smileMartin Melin
 
Protocol in Swift
Protocol in SwiftProtocol in Swift
Protocol in SwiftYusuke Kita
 

Mais procurados (20)

How to Profit from Static Analysis
How to Profit from Static AnalysisHow to Profit from Static Analysis
How to Profit from Static Analysis
 
Functions in C++ (OOP)
Functions in C++ (OOP)Functions in C++ (OOP)
Functions in C++ (OOP)
 
JavaScript fundamental data types and functions
JavaScript fundamental data types and functionsJavaScript fundamental data types and functions
JavaScript fundamental data types and functions
 
At Last an OCL Debugger
At Last an OCL DebuggerAt Last an OCL Debugger
At Last an OCL Debugger
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Example First / A Sane Test-Driven Approach to Programming
Example First / A Sane Test-Driven Approach to ProgrammingExample First / A Sane Test-Driven Approach to Programming
Example First / A Sane Test-Driven Approach to Programming
 
C++ programming function
C++ programming functionC++ programming function
C++ programming function
 
Pyunit
PyunitPyunit
Pyunit
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
 
History of asynchronous in .NET
History of asynchronous in .NETHistory of asynchronous in .NET
History of asynchronous in .NET
 
Annotation processor and compiler plugin
Annotation processor and compiler pluginAnnotation processor and compiler plugin
Annotation processor and compiler plugin
 
The OCLforUML Profile
The OCLforUML ProfileThe OCLforUML Profile
The OCLforUML Profile
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Learning C++ - Functions in C++ 3
Learning C++ - Functions  in C++ 3Learning C++ - Functions  in C++ 3
Learning C++ - Functions in C++ 3
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in Swift
 
Python unittest
Python unittestPython unittest
Python unittest
 
Csc1100 lecture05 ch05
Csc1100 lecture05 ch05Csc1100 lecture05 ch05
Csc1100 lecture05 ch05
 
TDD and mobile development: some forgotten techniques, illustrated with Android
TDD and mobile development: some forgotten techniques, illustrated with AndroidTDD and mobile development: some forgotten techniques, illustrated with Android
TDD and mobile development: some forgotten techniques, illustrated with Android
 
Command line arguments that make you smile
Command line arguments that make you smileCommand line arguments that make you smile
Command line arguments that make you smile
 
Protocol in Swift
Protocol in SwiftProtocol in Swift
Protocol in Swift
 

Semelhante a What's new in C# 8.0 (beta)

Semelhante a What's new in C# 8.0 (beta) (20)

What’s new in .NET
What’s new in .NETWhat’s new in .NET
What’s new in .NET
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
 
Amusing C#
Amusing C#Amusing C#
Amusing C#
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Linq intro
Linq introLinq intro
Linq intro
 
C# 7 development
C# 7 developmentC# 7 development
C# 7 development
 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginners
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
Object Oriented Programming using C++ - Part 4
Object Oriented Programming using C++ - Part 4Object Oriented Programming using C++ - Part 4
Object Oriented Programming using C++ - Part 4
 
Java gets a closure
Java gets a closureJava gets a closure
Java gets a closure
 
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]
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScript
 
C#unit4
C#unit4C#unit4
C#unit4
 
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
 
What's new in c# 8.0
What's new in c# 8.0What's new in c# 8.0
What's new in c# 8.0
 
What's New in Visual Studio 2008
What's New in Visual Studio 2008What's New in Visual Studio 2008
What's New in Visual Studio 2008
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
 
C#.net evolution part 2
C#.net evolution part 2C#.net evolution part 2
C#.net evolution part 2
 
Greg Demo Slides
Greg Demo SlidesGreg Demo Slides
Greg Demo Slides
 

Mais de Muralidharan Deenathayalan (10)

Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Alfresco 5.0 features
Alfresco 5.0 featuresAlfresco 5.0 features
Alfresco 5.0 features
 
Test drive on driven development process
Test drive on driven development processTest drive on driven development process
Test drive on driven development process
 
Map Reduce introduction
Map Reduce introductionMap Reduce introduction
Map Reduce introduction
 
Apache Hive - Introduction
Apache Hive - IntroductionApache Hive - Introduction
Apache Hive - Introduction
 
Apache cassandra
Apache cassandraApache cassandra
Apache cassandra
 
Alfresco share 4.1 to 4.2 customisation
Alfresco share 4.1 to 4.2 customisationAlfresco share 4.1 to 4.2 customisation
Alfresco share 4.1 to 4.2 customisation
 
Introduction about Alfresco webscript
Introduction about Alfresco webscriptIntroduction about Alfresco webscript
Introduction about Alfresco webscript
 
Alfresco activiti workflows
Alfresco activiti workflowsAlfresco activiti workflows
Alfresco activiti workflows
 
Alfresco content model
Alfresco content modelAlfresco content model
Alfresco content model
 

Último

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Último (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

What's new in C# 8.0 (beta)

  • 1. PRESENTS Coimbatore, Tamil Nadu, India Dec 22, 2018 Brought to you by Microsoft Connect(); 2018 - Local Event Muralidharan Deenathayalan Technical Architect at Quanticate What's New in C# 8.0
  • 2. Brought to you by • C# - A quick definition • Evolution history of C# • New features of C# 8.0 • Demo • How I can learn more? • Q & A • Reference links 2 Agenda
  • 3. Brought to you by • Nullable reference type • Implicitly-typed new-expressions • Ranges and indices • Default implementations of interface members • Recursive patterns • Switch expressions • Asynchronous streams 3 New features of C# 8.0
  • 4. Brought to you by 4 C# - A quick definition
  • 5. Brought to you by 5 Evolution history of C# C# Version .net Fx Version Visual Studio Version Date 1.0 NET Framework 1.0 Visual Studio .NET 2002 January 2002 1.1, 1.2 .NET Framework 1.1 Visual Studio .NET 2003 April 2003 C# 2.0 .NET Framework 2.0 Visual Studio 2005 November 2005 C# 3.0 .NET Framework 3.0 Visual Studio 2008 November 2006 C# 3.5 .NET Framework 3.5 Visual Studio 2010 November 2007 C# 4.0 .NET Framework 4 Visual Studio 2010 April 2010 C# 5.0 .NET Framework 4.5 Visual Studio 2012 Visual Studio 2013 August 2012 C# 6.0 .NET Framework 4.6 Visual Studio 2015 July 2015 C# 7.0 .NET Framework 4.6.2 Visual Studio 2017 March 2017 C# 7.1 .NET Framework 4.7 Visual Studio 2017 v 15.3 August 2017 C# 7.2 .NET Framework 4.7.1 Visual Studio 2017 v 15.5 November 2017 C# 7.3 .NET Framework 4.7.2 Visual Studio 2017 v 15.7 May 2018 C# 8.0 - beta .NET Framework 4.8 Visual Studio 2019
  • 6. Brought to you by • C# variable types: Primitives and Reference types • Primitive data type • int, char can’t accept null • Will have default value of 0 or depends on its data type • To support, make is nullable like int? • Ex : int?, char? • Reference type • Class etc • Accepts null • Default value will be null unless initialized • Ex: string 6 Nullable reference type
  • 7. Brought to you by • Allow developers to express whether a variable, parameter or result of a reference type is intended to be null or not. • Provide optional warnings when such variables, parameters and results are not used according to their intent. 7 Nullable reference type
  • 8. Brought to you by • Select C# version to 8.0 (beta) • Add #nullable enable in the class level 8 Nullable reference type string myname = null; //will throw warning Console.WriteLine(myname.Length); //Will throw below warnings • WarningCS8600 Converting null literal or possible null value to non-nullable type. • WarningCS8602 Possible dereference of a null reference.
  • 9. Brought to you by • Select C# version to 8.0 (beta) • Add #nullable enable in the class level Converting to nullable as below. 9 Nullable reference type string? myname = null; //will throw warning Console.WriteLine(myname.Length); //Will throw below warnings • WarningCS8602 Possible dereference of a null reference.
  • 10. Brought to you by To avoid this warning, add null check 10 Nullable reference type string? myname = null; if (myName != null) Console.WriteLine(myName.Length); else Console.WriteLine(0);
  • 11. Brought to you by 11 Implicitly-typed new-expressions Author[] authors = { new Author("William", "Shakespeare"), new Author("John", " Ford") };
  • 12. Brought to you by 12 Implicitly-typed new-expressions Author[] authors = { new ("William", "Shakespeare"), new ("John", " Ford") };//new Syntax. No need specify the type here
  • 13. Brought to you by • Simple syntax for slicing out a part of an array • New type is called ‘Range’ • Endpoint is exclusive • new ^ operator, meaning "from end" • Examples, • 1..4 • ..1 • 1.. • 1..^2 • ^2.. 13 Ranges and indices
  • 14. Brought to you by 14 Ranges and indices foreach (var name in names[1..4]) { Console.WriteLine(name); } // Getting 1,2 and 3rd element Range range = 1..4; foreach (var name in names[range]) { Console.WriteLine(name); }//Range variable is used foreach (var name in names[1..^ 1]) { Console.WriteLine(name); }//Starting from 1st element and ending from last 1 element
  • 15. Brought to you by • Default interface methods (also known as virtual extension methods) • C# Addresses the diamond inheritance problem that can occur with default interface methods by taking the most specific override at runtime. 15 Default implementations of interface members
  • 16. Brought to you by 16 Default implementations of interface members interface IDefaultInterfaceMethod { public void DefaultMethod() { Console.WriteLine("I am a default method in the interface!"); } } class AnyClass : IDefaultInterfaceMethod { }
  • 17. Brought to you by 17 Default implementations of interface members IDefaultInterfaceMethod anyClass = new AnyClass(); anyClass.DefaultMethod();
  • 18. Brought to you by 18 Default implementations of interface members AnyClass anyClass = new AnyClass(); anyClass.DefaultMethod(); //compilation error • AnyClass does not contain a member DefaultMethod. • That is the proof that the inherited class does not know anything about the default method.
  • 19. Brought to you by 19 Recursive patterns Author author = new Author("William", "Shakespeare"); switch (author.FirstName, author.LastName) { case (string fn, string ln): return $"{fn} {ln} "; case (string fn, null): return $"{fn} "; case (null, ln): return $"Mr/Mrs {ln} "; case (null, null): return $"New author "; }
  • 20. Brought to you by 20 Switch expressions Author author = new Author("William","Shakespeare"); return (author.FirstName, author.LastName) switch { (string fn, string ln) => $"{fn} {ln}", (string fn, null) => $"{ fn}" , (null, ln) => $"Mr/Mrs { ln}" , (null, null) => $"New author " };
  • 21. Brought to you by • Asynchrous programming techniques provide a way to improve a program's responsiveness • Async/Await pattern debuted in C# 5, but is limited to returning a single scalar value. • C# 8 adds Async Streams, which allows an async method to return multiple values • async Task < int > DoAnythingAsync(). The result of DoAnythingAsync is an integer (One value). • Because of this limitation, you cannot use this feature with yield keyword, and you cannot use it with the async IEnumerable < int > (which returns an async enumeration). 21 Asynchronous streams
  • 22. Brought to you by • async/awaiting feature with a yielding operator = Async Stream • asynchronous data pull or pull based enumeration or async sequence in F# 22 Asynchronous streams
  • 23. Brought to you by 23 Demo
  • 24. Brought to you by • https://github.com/dotnet/csharplang/tree/master/proposals • https://github.com/dotnet/roslyn/blob/master/docs/Language% 20Feature%20Status.md • https://github.com/dotnet/roslyn 24 How I can learn more?
  • 25. Brought to you by 25 Q & A
  • 26. Brought to you by • https://github.com/dotnet/coreclr/issues/21379 for IAsyncEnumberable<T> • https://www.infoq.com/articles/default-interface-methods-cs8 • https://www.infoq.com/articles/cs8-ranges-and-recursive- patterns 26 References
  • 27. Brought to you by 27 Keep in touch Muralidharan Deenathayalan Blog : www.codingfreaks.net Github : https://github.com/muralidharand LinkedIn : https://www.linkedin.com/in/muralidharand Twitter : https://twitter.com/muralidharand