SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
History of C#Andreas Schlapsi / @aschlapsi
Andreas Schlapsi ( )@aschlapsi
C# since 2002
January 2002
Subversion was still replacing CVS
Euro banknotes and coins become legal tender in 12 member states
of the EU
January 2002
January 2002
Microsoft releases the first version of the .NET framework with its new
language C#
C# 1.0 - Key Features
Managed Code (.NET)
IL Code (Intermediate Language)
Common Language Runtime (Visual Basic.NET, J#, F#, ...)
Base Class Library
Garbage Collector
C# 1.0 - Key Features
OOP (classes)
like Java
no multiple inheritance
C# 1.0 - Key Features
Properties
publicclassExampleClass
{
privateint_number;
publicintNumber
{
get{return_number;}
set{_number=value;}
}
}
C# 1.0 - Key Features
Delegates and Events
Delegate: data structure that refers to either a static method, or an
object and an instance method of its class
C# 1.0 - Key Features
Delegates and Events
publicdelegateintChangeInt(intx);
publicclassExampleClass
{
publicstaticintDoubleIt(intn)
{
returnn*2;
}
publicvoidDoSomething()
{
ChangeIntmyDelegate=newChangeInt(DoubleIt);
Console.WriteLine("{0}",myDelegate(5));
}
}
C# 1.0 - Demo: Counter1
November 2005
C# 2.0
C# 2.0 - Key Features
Generics
publicclassExampleClass
{
publicvoidBefore()
{
ArrayListlist=newArrayList();
list.Add(42);
intx=2+(int)list[0];
}
publicvoidInCSharp2()
{
List<int>list=newList<int>();
list.Add(42);
intx=2+list[0];
}
}
C# 2.0 - Key Features
Anonymous Methods
publicdelegateintChangeInt(intx);
publicclassExampleClass
{
publicvoidDoSomething()
{
ChangeIntmyDelegate=newChangeInt(
delegate(intx)
{
returnx*2;
}
);
Console.WriteLine("{0}",myDelegate(5));
}
}
C# 2.0 - Key Features
Nullable Types
Reference Types
reference to object on heap
can be null
Value Types
object on stack or embedded
can not be null
C# 2.0 - Key Features
Nullable Types
publicclassExampleClass
{
publicvoidDoSomething()
{
int?nullableInt=42;
Nullable<int>int2=null;
if(nullableInt.HasValue)
{
Console.WriteLine(nullableInt.Value);
}
}
}
C# 2.0 - Key Features
Iterators
publicinterfaceIEnumerable<T>
{
IEnumerator<T>GetEnumerator();
}
publicinterfaceIEnumerator<T>:IDisposable
{
TCurrent{get;}
voidMoveNext();
voidReset();
}
C# 2.0 - Key Features
Iterators
publicclassExampleClass
{
publicvoidDoSomething()
{
List<string>list=newList<string>();
list.Add("Hello");
list.Add("World");
IEnumerable<string>enumerable=list;
foreach(stringstrinenumerable)
Console.WriteLine(str);
}
}
C# 2.0 - Key Features
Iterators
publicclassExampleClass
{
publicvoidDoSomething()
{
foreach(intstrinIterate())
Console.WriteLine(str);
}
publicIEnumerable<int>Iterate()
{
yieldreturn1;
yieldreturn2;
yieldreturn3;
yieldreturn4;
}
}
C# 2.0 - Demo: Counter2
C# 2.0 - Demo: IteratorExample
November 2007
C# 3.0
C# 3.0 - Key Features
Lambda Expressions
publicdelegateintChangeInt(intx);
publicclassExampleClass
{
publicvoidDoSomething()
{
ChangeIntmyDelegate=x=>x*2;
Console.WriteLine("{0}",myDelegate(5));
}
}
C# 3.0 - Key Features
Extension Methods
"Add" methods to existing types without creating a new derived type,
recompiling, or otherwise modifying the original type.
C# 3.0 - Key Features
Extension Methods
namespaceExtensions
{
publicstaticclassStringExtensions
{
publicstaticintWordCount(thisstringstr)
{
returnstr.split(newchar[]{&#39;&#39;,&#39;.&#39;,&#39;?&#39;}
StringSplitOptions.RemoveEmptyEntries).Length;
}
}
}
C# 3.0 - Key Features
Extension Methods
usingExtensions;
publicclassExampleClass
{
publicvoidDoSomething()
{
strings="HelloExtensionMethods";
inti=s.WordCount();
Console.WriteLine(i);
}
}
C# 3.0 - Key Features
Expression Trees - Parsing
Expression<Func<int,bool>>exprTree=num=>num<5;
ParameterExpressionparam=(ParameterExpression)exprTree.Parameters[0];
BinaryExpressionoperation=(BinaryExpression)exprTree.Body;
ParameterExpressionleft=(ParameterExpression)operation.Left;
ConstantExpressionright=(ConstantExpression)operation.Right;
Console.WriteLine("Decomposedexpression:{0}=>{1}{2}{3}",
param.Name,left.Name,operation.NodeType,right.Value);
C# 3.0 - Key Features
Expression Trees - Compiling
Expression<Func<int,bool>>exprTree=num=>num<5;
Func<int,bool>result=exprTree.Compile();
Console.WriteLine(result(4));
C# 3.0 - Key Features
Anonymous Types
varv=new{Amount=108,Message="Hello"};
Console.WriteLine(v.Amount+v.Message);
C# 3.0 - Key Features
Implicit Typing (Type Inferencing)
//inti=5;
vari=5;
//strings="Hello";
vars="Hello";
//int[]a=new[]{0,1,2};
vara=new[]{0,1,2};
varanon=new{Name="Terry",Age=34};
C# 3.0 - Key Features
Language Integrated Query (LINQ)
IEnumerable<Product>products;
varproductQuery=products
.Where(product=>product.Price>50.0)
.Select(product=>new{product.Color,product.Price});
C# 3.0 - Key Features
Language Integrated Query (LINQ)
varproductQuery=
fromproductinproducts
whereproduct.Price>50.0
selectnew{product.Color,product.Price};
varexpr=
fromcincustomers
wherec.City="Vienna"
selectc;
C# 3.0 - Demo: Counter3
C# 3.0 - Demo:
ExtensionMethods
C# 3.0 - Demo: ExpressionTrees
C# 3.0 - Demo: LinqExample
April 2010
C# 4.0
C# 4.0 - Key Features
Late Binding (dynamic)
object of type dynamic bypasses static type checking.
=> if code is not valid, errors are caught at run time!
C# 4.0 - Key Features
Late Binding (dynamic)
Dynamic Language Runtime (IronPython)
HTML DOM
Reflection API
COM Interop
C# 4.0 - Key Features
Late Binding (dynamic)
before C# 4.0:
((Excel.Range)excelApp.Cells[1,1]).Value2="Name";
Excel.Rangerange2008=(Excel.Range)excelApp.Cells[1,1];
C# 4.0:
//accesstotheValuepropertyandtheconversionto
//Excel.Rangearehandledbytherun-timeCOMbinder
excelApp.Cells[1,1].Value="Name";
Excel.Rangerange2010=excelApp.Cells[1,1];
C# 4.0 - Demo:
DynamicExample
C# 4.0 - Key Features
Named and optional arguments
C# 4.0 - Demo:
NamedAndOptionalArguments
August 2012
C# 5.0
C# 5.0 - Key Features
Async
C# 5.0 - Demo: AsyncConsole
C# 5.0 - Demo: AsyncExample
? 2015
C# 6
Roslyn
set of open-source compilers and code analysis APIs for C# and VB
Apache License 2.0
Language features in C# 6 and VB 14

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net frameworkArun Prasad
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages mohamed drahem
 
Spring Security e Spring Boot Aula - 2018
Spring Security e Spring Boot Aula - 2018Spring Security e Spring Boot Aula - 2018
Spring Security e Spring Boot Aula - 2018André Luiz Forchesatto
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeRamon Ribeiro Rabello
 
Architecture of net framework
Architecture of net frameworkArchitecture of net framework
Architecture of net frameworkumesh patil
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Abou Bakr Ashraf
 
Spring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaSpring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaMariana de Azevedo Santos
 
Kotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptxKotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptxtakshilkunadia
 
Try Jetpack Compose
Try Jetpack ComposeTry Jetpack Compose
Try Jetpack ComposeLutasLin
 
Introdução ao Spring Framework MVC
Introdução ao Spring Framework MVCIntrodução ao Spring Framework MVC
Introdução ao Spring Framework MVCMessias Batista
 
dot net technology
dot net technologydot net technology
dot net technologyImran Khan
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 

Was ist angesagt? (20)

Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages
 
Spring Security e Spring Boot Aula - 2018
Spring Security e Spring Boot Aula - 2018Spring Security e Spring Boot Aula - 2018
Spring Security e Spring Boot Aula - 2018
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Declarative UIs with Jetpack Compose
Declarative UIs with Jetpack ComposeDeclarative UIs with Jetpack Compose
Declarative UIs with Jetpack Compose
 
Spring notes
Spring notesSpring notes
Spring notes
 
Architecture of net framework
Architecture of net frameworkArchitecture of net framework
Architecture of net framework
 
Spring Data Jpa
Spring Data JpaSpring Data Jpa
Spring Data Jpa
 
C#.NET
C#.NETC#.NET
C#.NET
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
Spring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaSpring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em Java
 
C# in depth
C# in depthC# in depth
C# in depth
 
Kotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptxKotlin Basics & Introduction to Jetpack Compose.pptx
Kotlin Basics & Introduction to Jetpack Compose.pptx
 
Try Jetpack Compose
Try Jetpack ComposeTry Jetpack Compose
Try Jetpack Compose
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Introdução ao Spring Framework MVC
Introdução ao Spring Framework MVCIntrodução ao Spring Framework MVC
Introdução ao Spring Framework MVC
 
dot net technology
dot net technologydot net technology
dot net technology
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 

Ähnlich wie History of C#

Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008Luis Enrique
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingHock Leng PUAH
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01Zafor Iqbal
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptxarjun431527
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp PresentationVishwa Mohan
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NETmentorrbuddy
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#SyedUmairAli9
 

Ähnlich wie History of C# (20)

OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
C#ppt
C#pptC#ppt
C#ppt
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
Csharp generics
Csharp genericsCsharp generics
Csharp generics
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp Presentation
 
C#2
C#2C#2
C#2
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NET
 
C#.net Evolution part 1
C#.net Evolution part 1C#.net Evolution part 1
C#.net Evolution part 1
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
02.adt
02.adt02.adt
02.adt
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
 

Kürzlich hochgeladen

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

History of C#

  • 1. History of C#Andreas Schlapsi / @aschlapsi
  • 2. Andreas Schlapsi ( )@aschlapsi C# since 2002
  • 3. January 2002 Subversion was still replacing CVS Euro banknotes and coins become legal tender in 12 member states of the EU
  • 5. January 2002 Microsoft releases the first version of the .NET framework with its new language C#
  • 6. C# 1.0 - Key Features Managed Code (.NET) IL Code (Intermediate Language) Common Language Runtime (Visual Basic.NET, J#, F#, ...) Base Class Library Garbage Collector
  • 7. C# 1.0 - Key Features OOP (classes) like Java no multiple inheritance
  • 8. C# 1.0 - Key Features Properties publicclassExampleClass { privateint_number; publicintNumber { get{return_number;} set{_number=value;} } }
  • 9. C# 1.0 - Key Features Delegates and Events Delegate: data structure that refers to either a static method, or an object and an instance method of its class
  • 10. C# 1.0 - Key Features Delegates and Events publicdelegateintChangeInt(intx); publicclassExampleClass { publicstaticintDoubleIt(intn) { returnn*2; } publicvoidDoSomething() { ChangeIntmyDelegate=newChangeInt(DoubleIt); Console.WriteLine("{0}",myDelegate(5)); } }
  • 11. C# 1.0 - Demo: Counter1
  • 13. C# 2.0 - Key Features Generics publicclassExampleClass { publicvoidBefore() { ArrayListlist=newArrayList(); list.Add(42); intx=2+(int)list[0]; } publicvoidInCSharp2() { List<int>list=newList<int>(); list.Add(42); intx=2+list[0]; } }
  • 14. C# 2.0 - Key Features Anonymous Methods publicdelegateintChangeInt(intx); publicclassExampleClass { publicvoidDoSomething() { ChangeIntmyDelegate=newChangeInt( delegate(intx) { returnx*2; } ); Console.WriteLine("{0}",myDelegate(5)); } }
  • 15. C# 2.0 - Key Features Nullable Types Reference Types reference to object on heap can be null Value Types object on stack or embedded can not be null
  • 16. C# 2.0 - Key Features Nullable Types publicclassExampleClass { publicvoidDoSomething() { int?nullableInt=42; Nullable<int>int2=null; if(nullableInt.HasValue) { Console.WriteLine(nullableInt.Value); } } }
  • 17. C# 2.0 - Key Features Iterators publicinterfaceIEnumerable<T> { IEnumerator<T>GetEnumerator(); } publicinterfaceIEnumerator<T>:IDisposable { TCurrent{get;} voidMoveNext(); voidReset(); }
  • 18. C# 2.0 - Key Features Iterators publicclassExampleClass { publicvoidDoSomething() { List<string>list=newList<string>(); list.Add("Hello"); list.Add("World"); IEnumerable<string>enumerable=list; foreach(stringstrinenumerable) Console.WriteLine(str); } }
  • 19. C# 2.0 - Key Features Iterators publicclassExampleClass { publicvoidDoSomething() { foreach(intstrinIterate()) Console.WriteLine(str); } publicIEnumerable<int>Iterate() { yieldreturn1; yieldreturn2; yieldreturn3; yieldreturn4; } }
  • 20. C# 2.0 - Demo: Counter2
  • 21. C# 2.0 - Demo: IteratorExample
  • 23. C# 3.0 - Key Features Lambda Expressions publicdelegateintChangeInt(intx); publicclassExampleClass { publicvoidDoSomething() { ChangeIntmyDelegate=x=>x*2; Console.WriteLine("{0}",myDelegate(5)); } }
  • 24. C# 3.0 - Key Features Extension Methods "Add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.
  • 25. C# 3.0 - Key Features Extension Methods namespaceExtensions { publicstaticclassStringExtensions { publicstaticintWordCount(thisstringstr) { returnstr.split(newchar[]{&#39;&#39;,&#39;.&#39;,&#39;?&#39;} StringSplitOptions.RemoveEmptyEntries).Length; } } }
  • 26. C# 3.0 - Key Features Extension Methods usingExtensions; publicclassExampleClass { publicvoidDoSomething() { strings="HelloExtensionMethods"; inti=s.WordCount(); Console.WriteLine(i); } }
  • 27. C# 3.0 - Key Features Expression Trees - Parsing Expression<Func<int,bool>>exprTree=num=>num<5; ParameterExpressionparam=(ParameterExpression)exprTree.Parameters[0]; BinaryExpressionoperation=(BinaryExpression)exprTree.Body; ParameterExpressionleft=(ParameterExpression)operation.Left; ConstantExpressionright=(ConstantExpression)operation.Right; Console.WriteLine("Decomposedexpression:{0}=>{1}{2}{3}", param.Name,left.Name,operation.NodeType,right.Value);
  • 28. C# 3.0 - Key Features Expression Trees - Compiling Expression<Func<int,bool>>exprTree=num=>num<5; Func<int,bool>result=exprTree.Compile(); Console.WriteLine(result(4));
  • 29. C# 3.0 - Key Features Anonymous Types varv=new{Amount=108,Message="Hello"}; Console.WriteLine(v.Amount+v.Message);
  • 30. C# 3.0 - Key Features Implicit Typing (Type Inferencing) //inti=5; vari=5; //strings="Hello"; vars="Hello"; //int[]a=new[]{0,1,2}; vara=new[]{0,1,2}; varanon=new{Name="Terry",Age=34};
  • 31. C# 3.0 - Key Features Language Integrated Query (LINQ) IEnumerable<Product>products; varproductQuery=products .Where(product=>product.Price>50.0) .Select(product=>new{product.Color,product.Price});
  • 32. C# 3.0 - Key Features Language Integrated Query (LINQ) varproductQuery= fromproductinproducts whereproduct.Price>50.0 selectnew{product.Color,product.Price}; varexpr= fromcincustomers wherec.City="Vienna" selectc;
  • 33. C# 3.0 - Demo: Counter3
  • 34. C# 3.0 - Demo: ExtensionMethods
  • 35. C# 3.0 - Demo: ExpressionTrees
  • 36. C# 3.0 - Demo: LinqExample
  • 38. C# 4.0 - Key Features Late Binding (dynamic) object of type dynamic bypasses static type checking. => if code is not valid, errors are caught at run time!
  • 39. C# 4.0 - Key Features Late Binding (dynamic) Dynamic Language Runtime (IronPython) HTML DOM Reflection API COM Interop
  • 40. C# 4.0 - Key Features Late Binding (dynamic) before C# 4.0: ((Excel.Range)excelApp.Cells[1,1]).Value2="Name"; Excel.Rangerange2008=(Excel.Range)excelApp.Cells[1,1]; C# 4.0: //accesstotheValuepropertyandtheconversionto //Excel.Rangearehandledbytherun-timeCOMbinder excelApp.Cells[1,1].Value="Name"; Excel.Rangerange2010=excelApp.Cells[1,1];
  • 41. C# 4.0 - Demo: DynamicExample
  • 42. C# 4.0 - Key Features Named and optional arguments
  • 43. C# 4.0 - Demo: NamedAndOptionalArguments
  • 45. C# 5.0 - Key Features Async
  • 46. C# 5.0 - Demo: AsyncConsole
  • 47. C# 5.0 - Demo: AsyncExample
  • 48. ? 2015 C# 6 Roslyn set of open-source compilers and code analysis APIs for C# and VB Apache License 2.0 Language features in C# 6 and VB 14