SlideShare uma empresa Scribd logo
1 de 41
Introduction to C#  Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation
C# – The Big Ideas ,[object Object],[object Object],[object Object],[object Object]
C# – The Big Ideas A component oriented language ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# – The Big Ideas Everything really is an object ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# – The Big Ideas Robust and durable software ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# – The Big Ideas Preservation of Investment ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Hello World using System; class Hello { static void Main() { Console.WriteLine("Hello world"); } }
C# Program Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# Program Structure using System; namespace System.Collections { public class Stack { Entry top; public void Push(object data) { top = new Entry(top, data); } public object Pop() { if (top == null) throw new InvalidOperationException(); object result = top.data; top = top.next; return result; } } }
Type System ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],int i = 123; string s = "Hello world"; 123 i s "Hello world"
Type System ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Predefined Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Structs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classes And Structs class CPoint { int x, y; ... } struct SPoint { int x, y; ... } CPoint cp = new CPoint(10, 20); SPoint sp = new SPoint(10, 20); 10 20 sp cp 10 20 CPoint
Interfaces ,[object Object],[object Object],[object Object],interface IDataBound { void Bind(IDataBinder binder); } class EditBox: Control, IDataBound { void IDataBound.Bind(IDataBinder binder) {...} }
Enums ,[object Object],[object Object],[object Object],[object Object],[object Object],enum Color: byte { Red  = 1, Green = 2, Blue  = 4, Black = 0, White = Red | Green | Blue, }
Delegates ,[object Object],[object Object],[object Object],[object Object],[object Object],delegate void MouseEvent(int x, int y); delegate double Func(double x); Func func = new Func(Math.Sin); double x = func(1.0);
Unified Type System ,[object Object],[object Object],[object Object],Stream MemoryStream FileStream Hashtable double int object
Unified Type System ,[object Object],[object Object],[object Object],[object Object],int i = 123; object o = i; int j = (int)o; 123 i o 123 System.Int32 123 j
Unified Type System ,[object Object],[object Object],[object Object],[object Object],[object Object],string s = string.Format( "Your total was {0} on {1}", total, date); Hashtable t = new Hashtable(); t.Add(0, "zero"); t.Add(1, "one"); t.Add(2, "two");
Component Development ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Properties ,[object Object],[object Object],public class Button: Control { private string caption; public string Caption { get { return caption; } set { caption = value; Repaint(); } } } Button b = new Button(); b.Caption = "OK"; String s = b.Caption;
Indexers ,[object Object],[object Object],public class ListBox: Control { private string[] items; public string this[int index] { get { return items[index]; } set {   items[index] = value; Repaint(); } } } ListBox listBox = new ListBox(); listBox[0] = "hello"; Console.WriteLine(listBox[0]);
Events  Sourcing ,[object Object],[object Object],public delegate void EventHandler(object sender, EventArgs e); public class Button {   public event EventHandler Click; protected void OnClick(EventArgs e) {   if (Click != null) Click(this, e);   } }
Events  Handling ,[object Object],public class MyForm: Form { Button okButton; public MyForm() { okButton = new Button(...); okButton.Caption = "OK"; okButton.Click += new EventHandler(OkButtonClick); } void OkButtonClick(object sender, EventArgs e) { ShowMessage("You pressed the OK button"); } }
Attributes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Attributes public class OrderProcessor { [WebMethod] public void SubmitOrder(PurchaseOrder order) {...} } [XmlRoot("Order", Namespace="urn:acme.b2b-schema.v1")] public class PurchaseOrder { [XmlElement("shipTo")]  public Address ShipTo; [XmlElement("billTo")]  public Address BillTo; [XmlElement("comment")] public string Comment; [XmlElement("items")]  public Item[] Items; [XmlAttribute("date")]  public DateTime OrderDate; } public class Address {...} public class Item {...}
Attributes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
XML Comments class XmlElement { /// <summary> ///  Returns the attribute with the given name and ///  namespace</summary> /// <param name=&quot;name&quot;> ///  The name of the attribute</param> /// <param name=&quot;ns&quot;> ///  The namespace of the attribute, or null if ///  the attribute has no namespace</param> /// <return> ///  The attribute value, or null if the attribute ///  does not exist</return> /// <seealso cref=&quot;GetAttr(string)&quot;/> /// public string GetAttr(string name, string ns) { ... } }
Statements And Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void Foo() { i == 1;  // error }
foreach Statement ,[object Object],[object Object],foreach (Customer c in customers.OrderBy(&quot;name&quot;)) { if (c.Orders.Count != 0) { ... } } public static void Main(string[] args) { foreach (string s in args) Console.WriteLine(s); }
Parameter Arrays ,[object Object],[object Object],void printf(string fmt, params object[] args) { foreach (object x in args) { ... } } printf(&quot;%s %i %i&quot;, str, int1, int2); object[] args = new object[3]; args[0] = str; args[1] = int1; Args[2] = int2; printf(&quot;%s %i %i&quot;, args);
Operator Overloading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Operator Overloading public struct DBInt { public static readonly DBInt Null = new DBInt();   private int value; private bool defined; public bool IsNull { get { return !defined; } } public static DBInt operator +(DBInt x, DBInt y) {...} public static implicit operator DBInt(int x) {...} public static explicit operator int(DBInt x) {...} } DBInt x = 123; DBInt y = DBInt.Null; DBInt z = x + y;
Versioning ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Versioning class Derived: Base // version 1 { public virtual void Foo() { Console.WriteLine(&quot;Derived.Foo&quot;);  } } class Derived: Base // version 2a { new public virtual void Foo() { Console.WriteLine(&quot;Derived.Foo&quot;);  } } class Derived: Base // version 2b { public override void Foo() { base.Foo(); Console.WriteLine(&quot;Derived.Foo&quot;);  } } class Base // version 1 { } class Base  // version 2  { public virtual void Foo() { Console.WriteLine(&quot;Base.Foo&quot;);  } }
Conditional Compilation ,[object Object],[object Object],[object Object],[object Object],public class Debug { [Conditional(&quot;Debug&quot;)] public static void Assert(bool cond, String s) { if (!cond) { throw new AssertionException(s); } } }
Unsafe Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],unsafe void Foo() { char* buf = stackalloc char[256]; for (char* p = buf; p < buf + 256; p++) *p = 0; ... }
Unsafe Code class FileStream: Stream { int handle; public unsafe int Read(byte[] buffer, int index, int count) { int n = 0; fixed (byte* p = buffer) { ReadFile(handle, p + index, count, &n, null); } return n; } [dllimport(&quot;kernel32&quot;, SetLastError=true)] static extern unsafe bool ReadFile(int hFile, void* lpBuffer, int nBytesToRead, int* nBytesRead, Overlapped* lpOverlapped); }
More Information ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

C# / Java Language Comparison
C# / Java Language ComparisonC# / Java Language Comparison
C# / Java Language ComparisonRobert Bachmann
 
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITKAdvanced CPP Lecture 1- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITKPankaj Prateek
 
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITKAdvanced CPP Lecture 2- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITKPankaj Prateek
 
3.3 programming fundamentals
3.3 programming fundamentals3.3 programming fundamentals
3.3 programming fundamentalsSayed Ahmed
 
Clean code and Code Smells
Clean code and Code SmellsClean code and Code Smells
Clean code and Code SmellsMario Sangiorgio
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++jehan1987
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and OperatorsSunil OS
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)jeffz
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1Vineeta Garg
 

Mais procurados (14)

C# / Java Language Comparison
C# / Java Language ComparisonC# / Java Language Comparison
C# / Java Language Comparison
 
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITKAdvanced CPP Lecture 1- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 1- Summer School 2014 - ACA CSE IITK
 
C#ppt
C#pptC#ppt
C#ppt
 
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITKAdvanced CPP Lecture 2- Summer School 2014 - ACA CSE IITK
Advanced CPP Lecture 2- Summer School 2014 - ACA CSE IITK
 
3.3 programming fundamentals
3.3 programming fundamentals3.3 programming fundamentals
3.3 programming fundamentals
 
Clean code
Clean codeClean code
Clean code
 
Functional Programming with C#
Functional Programming with C#Functional Programming with C#
Functional Programming with C#
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Clean code and Code Smells
Clean code and Code SmellsClean code and Code Smells
Clean code and Code Smells
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and Operators
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Classes and objects1
Classes and objects1Classes and objects1
Classes and objects1
 

Destaque

雲端筆記本 記憶與行動應用的深度整合
雲端筆記本 記憶與行動應用的深度整合雲端筆記本 記憶與行動應用的深度整合
雲端筆記本 記憶與行動應用的深度整合bunny4776
 
Shale Gas: Market Opportunities and Challenges in the EU and Ukraine
Shale Gas: Market Opportunities and Challenges in the EU and UkraineShale Gas: Market Opportunities and Challenges in the EU and Ukraine
Shale Gas: Market Opportunities and Challenges in the EU and UkraineOleksii Leshchenko
 
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011Hoa Sen University
 
Menus OnDemand
Menus OnDemandMenus OnDemand
Menus OnDemandsudderth1
 
Olivia lammers a day in the life
Olivia lammers a day in the lifeOlivia lammers a day in the life
Olivia lammers a day in the lifeolammersp1
 
Andrea Stephania Betancur Granda
Andrea Stephania Betancur GrandaAndrea Stephania Betancur Granda
Andrea Stephania Betancur GrandaAndreea Stephania
 
Commercial Portfolio
Commercial PortfolioCommercial Portfolio
Commercial Portfoliohomekab
 
Wayne pua sm portfolio
Wayne pua sm portfolioWayne pua sm portfolio
Wayne pua sm portfolioWayne Pua
 
Still photo assignment
Still photo assignment Still photo assignment
Still photo assignment StephanieUNCA
 
Harnessing e-Form Print Control
Harnessing e-Form Print ControlHarnessing e-Form Print Control
Harnessing e-Form Print ControlPlus Technologies
 
Top Ruby Gems to Start A Project
Top Ruby Gems to Start A ProjectTop Ruby Gems to Start A Project
Top Ruby Gems to Start A ProjectMichel Pigassou
 
Worksheet Listening
Worksheet ListeningWorksheet Listening
Worksheet Listeningsycindyng
 
I Kiss Your Hand Madame
I Kiss Your Hand MadameI Kiss Your Hand Madame
I Kiss Your Hand MadameMakala (D)
 
Infection control risk assessment
Infection control risk assessmentInfection control risk assessment
Infection control risk assessmentKhusnul Khatimah
 
Digital Partner for your Brand Communication
Digital Partner for your Brand CommunicationDigital Partner for your Brand Communication
Digital Partner for your Brand CommunicationSaurabh Pokharna
 

Destaque (20)

雲端筆記本 記憶與行動應用的深度整合
雲端筆記本 記憶與行動應用的深度整合雲端筆記本 記憶與行動應用的深度整合
雲端筆記本 記憶與行動應用的深度整合
 
Shale Gas: Market Opportunities and Challenges in the EU and Ukraine
Shale Gas: Market Opportunities and Challenges in the EU and UkraineShale Gas: Market Opportunities and Challenges in the EU and Ukraine
Shale Gas: Market Opportunities and Challenges in the EU and Ukraine
 
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011
Kỷ yếu tốt nghiệp Đại học Hoa Sen 12.2011
 
Menus OnDemand
Menus OnDemandMenus OnDemand
Menus OnDemand
 
Olivia lammers a day in the life
Olivia lammers a day in the lifeOlivia lammers a day in the life
Olivia lammers a day in the life
 
W h i t e ...
W h i t e ...W h i t e ...
W h i t e ...
 
Andrea Stephania Betancur Granda
Andrea Stephania Betancur GrandaAndrea Stephania Betancur Granda
Andrea Stephania Betancur Granda
 
History
HistoryHistory
History
 
Commercial Portfolio
Commercial PortfolioCommercial Portfolio
Commercial Portfolio
 
Kohus
KohusKohus
Kohus
 
Presentation1 cesm
Presentation1 cesmPresentation1 cesm
Presentation1 cesm
 
Wayne pua sm portfolio
Wayne pua sm portfolioWayne pua sm portfolio
Wayne pua sm portfolio
 
New paper JR
New paper JRNew paper JR
New paper JR
 
Still photo assignment
Still photo assignment Still photo assignment
Still photo assignment
 
Harnessing e-Form Print Control
Harnessing e-Form Print ControlHarnessing e-Form Print Control
Harnessing e-Form Print Control
 
Top Ruby Gems to Start A Project
Top Ruby Gems to Start A ProjectTop Ruby Gems to Start A Project
Top Ruby Gems to Start A Project
 
Worksheet Listening
Worksheet ListeningWorksheet Listening
Worksheet Listening
 
I Kiss Your Hand Madame
I Kiss Your Hand MadameI Kiss Your Hand Madame
I Kiss Your Hand Madame
 
Infection control risk assessment
Infection control risk assessmentInfection control risk assessment
Infection control risk assessment
 
Digital Partner for your Brand Communication
Digital Partner for your Brand CommunicationDigital Partner for your Brand Communication
Digital Partner for your Brand Communication
 

Semelhante a Introduction to-csharp-1229579367461426-1

Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharpSDFG5
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...NALESVPMEngg
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptAlmamoon
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.pptmothertheressa
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.pptpsundarau
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#singhadarsh
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpvoegtu
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpvoegtu
 
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptx
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptxPERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptx
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptxTriSandhikaJaya
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?Kevin Pilch
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaJevgeni Kabanov
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET componentsBình Trọng Án
 
Simulation Tool - Plugin Development
Simulation Tool - Plugin DevelopmentSimulation Tool - Plugin Development
Simulation Tool - Plugin DevelopmentFrank Bergmann
 

Semelhante a Introduction to-csharp-1229579367461426-1 (20)

Introduction to-csharp
Introduction to-csharpIntroduction to-csharp
Introduction to-csharp
 
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
Introduction to Csharp (C-Sharp) is a programming language developed by Micro...
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
Introduction-to-Csharp.ppt
Introduction-to-Csharp.pptIntroduction-to-Csharp.ppt
Introduction-to-Csharp.ppt
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.ppt
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptx
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptxPERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptx
PERTEMUAN 1 - MENGENAL ENVIRONTMENT PROGRAM VISUAL C#.pptx
 
Introduction to c_sharp
Introduction to c_sharpIntroduction to c_sharp
Introduction to c_sharp
 
1204csharp
1204csharp1204csharp
1204csharp
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
Simulation Tool - Plugin Development
Simulation Tool - Plugin DevelopmentSimulation Tool - Plugin Development
Simulation Tool - Plugin Development
 
C++ theory
C++ theoryC++ theory
C++ theory
 

Último

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Último (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Introduction to-csharp-1229579367461426-1

  • 1. Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Hello World using System; class Hello { static void Main() { Console.WriteLine(&quot;Hello world&quot;); } }
  • 8.
  • 9. C# Program Structure using System; namespace System.Collections { public class Stack { Entry top; public void Push(object data) { top = new Entry(top, data); } public object Pop() { if (top == null) throw new InvalidOperationException(); object result = top.data; top = top.next; return result; } } }
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Classes And Structs class CPoint { int x, y; ... } struct SPoint { int x, y; ... } CPoint cp = new CPoint(10, 20); SPoint sp = new SPoint(10, 20); 10 20 sp cp 10 20 CPoint
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. Attributes public class OrderProcessor { [WebMethod] public void SubmitOrder(PurchaseOrder order) {...} } [XmlRoot(&quot;Order&quot;, Namespace=&quot;urn:acme.b2b-schema.v1&quot;)] public class PurchaseOrder { [XmlElement(&quot;shipTo&quot;)] public Address ShipTo; [XmlElement(&quot;billTo&quot;)] public Address BillTo; [XmlElement(&quot;comment&quot;)] public string Comment; [XmlElement(&quot;items&quot;)] public Item[] Items; [XmlAttribute(&quot;date&quot;)] public DateTime OrderDate; } public class Address {...} public class Item {...}
  • 29.
  • 30. XML Comments class XmlElement { /// <summary> /// Returns the attribute with the given name and /// namespace</summary> /// <param name=&quot;name&quot;> /// The name of the attribute</param> /// <param name=&quot;ns&quot;> /// The namespace of the attribute, or null if /// the attribute has no namespace</param> /// <return> /// The attribute value, or null if the attribute /// does not exist</return> /// <seealso cref=&quot;GetAttr(string)&quot;/> /// public string GetAttr(string name, string ns) { ... } }
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Operator Overloading public struct DBInt { public static readonly DBInt Null = new DBInt(); private int value; private bool defined; public bool IsNull { get { return !defined; } } public static DBInt operator +(DBInt x, DBInt y) {...} public static implicit operator DBInt(int x) {...} public static explicit operator int(DBInt x) {...} } DBInt x = 123; DBInt y = DBInt.Null; DBInt z = x + y;
  • 36.
  • 37. Versioning class Derived: Base // version 1 { public virtual void Foo() { Console.WriteLine(&quot;Derived.Foo&quot;); } } class Derived: Base // version 2a { new public virtual void Foo() { Console.WriteLine(&quot;Derived.Foo&quot;); } } class Derived: Base // version 2b { public override void Foo() { base.Foo(); Console.WriteLine(&quot;Derived.Foo&quot;); } } class Base // version 1 { } class Base // version 2 { public virtual void Foo() { Console.WriteLine(&quot;Base.Foo&quot;); } }
  • 38.
  • 39.
  • 40. Unsafe Code class FileStream: Stream { int handle; public unsafe int Read(byte[] buffer, int index, int count) { int n = 0; fixed (byte* p = buffer) { ReadFile(handle, p + index, count, &n, null); } return n; } [dllimport(&quot;kernel32&quot;, SetLastError=true)] static extern unsafe bool ReadFile(int hFile, void* lpBuffer, int nBytesToRead, int* nBytesRead, Overlapped* lpOverlapped); }
  • 41.