SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
The C# Language




                          Johan Franzén




C# – Overview

                Panel 1                   Panel 2

  Object Oriented (similar to Java)

  Appeared in 2001

  .NET Platform (VB.NET, J#, Managed C++ and more)

  Microsoft Windows

  Linux and Mac OS X with the mono project




                                                     1
C# – Common Language Infrastructure

               Panel 1         Panel 2




C# – Hello World

                               Panel 2

  using System;

  class Hello
  {
     static void Main() {
        Console.WriteLine(quot;Hello
        Console.WriteLine(quot;Hello worldquot;);
     }
  }




                                            2
C# – Data types

  int                                           Panel 2

  float
  string
  byte
  bool
  .
  .
  .

  float fValue = 2.0f;
  double dValue = 2.0;

  bool bValue = 5 (incorrect)




C# – Value Types and Reference Types

                       Panel 1                  Panel 2

  Value Types                                Value Type
                                             Point is a Struct
  By Value (copy)                            Point p1 = new Point();
                                             Point p2 = p1;
  int, float, … , Point, Vector2 (structs)
                                             (p2 is a copy of p1)
  Reference Types
  By Reference (reference)
                                             Reference Type
  Classes
                                             Person is a Class
                                             Person p1 = new Person();
                                                             Person();
                                             Person p2 = p1;

                                             (p2 points to the same
                                             object as p1)




                                                                         3
C# – Array & List

   Array (fixed size)

     int[]
     int[] myArray = new int[10];
                         int[10];

     myArray[2]
     myArray[2] = 3;




   List (can grow)

     List<int>
     List<int> myList = new List<int>();
                            List<int>();

     myList.Add(3);
     myList.Add(3);

     int myValue = myList[0];
                   myList[0];




C# – Iteration

   Standard for loop

      o
     for( t              y st Cou tt;
                        myList.Count;
     for(int i = 0; i < myList.Count; i++) {
                                         )
        Console.WriteLine(myList[
        Console.WriteLine(myList[i]);
     }



   foreach loop

     foreach(
     foreach(int value in myList) {
                          myList)
        Console.WriteLine( l )
        Console.WriteLine(value);
        C    l W it Li (value);
     }




                                               4
C# – get/set methods

   Java           Panel 1
   ------------------------------------------------
   class Person {
      private int age;

     public int getAge() { return age; }
                getAge()

     public void setAge(int value) {
                  setAge(
        if(age
        if(age >= 0)
           age = value;
     }
   }
   ------------------------------------------------
   Person p = new Person();
                  Person();
   p.setAge(20);
   p.setAge(20);
   int age = p.getAge();
             p.getAge();




C# – Properties

   C#             Panel 1           Panel 2
   ------------------------------------------------
   class Person {
      private int age;

     public int Age {
        get { return age; }
        set {
           if(age
           if(age >= 0)
              age = value;
                    value;
        }
     }
   }
   ------------------------------------------------
   Person p = new Person();
                  Person();
   p.Age = 20;
   int age = p.Age;
             p.Age;




                                                      5
ACTION




         6

Weitere ähnliche Inhalte

Was ist angesagt?

C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st StudyChris Ohk
 
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13Chris Ohk
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th StudyChris Ohk
 
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...James Titcumb
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklistritu1806
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust languageGines Espada
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in goYusuke Kita
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQLvikram mahendra
 

Was ist angesagt? (20)

Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
Implementing stack
Implementing stackImplementing stack
Implementing stack
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
Static and const members
Static and const membersStatic and const members
Static and const members
 
Codejunk Ignitesd
Codejunk IgnitesdCodejunk Ignitesd
Codejunk Ignitesd
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C programs
C programsC programs
C programs
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13[C++ Korea] Effective Modern C++ Study, Item 11 - 13
[C++ Korea] Effective Modern C++ Study, Item 11 - 13
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
Mirror, mirror on the wall - Building a new PHP reflection library (Nomad PHP...
 
Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Elf文件解析
Elf文件解析Elf文件解析
Elf文件解析
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in go
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
week-20x
week-20xweek-20x
week-20x
 

Andere mochten auch

Rotation and Tessellation
Rotation and TessellationRotation and Tessellation
Rotation and TessellationJeanette Murphy
 
Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Kay Aniza
 
Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Kay Aniza
 
Meteor is Coming
Meteor is ComingMeteor is Coming
Meteor is ComingDaniel Teng
 
Advanced Blogging
Advanced BloggingAdvanced Blogging
Advanced Bloggingmythicgroup
 
Análisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoAnálisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoCarlos Alderetes
 
Smc073 11 april 2012 Vught
Smc073 11 april 2012 VughtSmc073 11 april 2012 Vught
Smc073 11 april 2012 VughtBart Brouwers
 
Management Final Project Fall 2008
Management Final Project Fall 2008Management Final Project Fall 2008
Management Final Project Fall 2008lat886
 
LambdaDay: Backbone.js
LambdaDay: Backbone.jsLambdaDay: Backbone.js
LambdaDay: Backbone.jsGiovanni Bassi
 
Zipmark product and market overview
Zipmark product and market overviewZipmark product and market overview
Zipmark product and market overviewJayastu Bhattacharya
 
E learners presentation 2010
E learners presentation 2010E learners presentation 2010
E learners presentation 2010Jeanette Murphy
 

Andere mochten auch (20)

Mobile Development
Mobile DevelopmentMobile Development
Mobile Development
 
Corei7
Corei7Corei7
Corei7
 
BDD no mundo real
BDD no mundo realBDD no mundo real
BDD no mundo real
 
Rotation and Tessellation
Rotation and TessellationRotation and Tessellation
Rotation and Tessellation
 
Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2Stpm Pam Kertas2 Set2
Stpm Pam Kertas2 Set2
 
Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2Skema Bm Kertas1 Set2
Skema Bm Kertas1 Set2
 
Meteor is Coming
Meteor is ComingMeteor is Coming
Meteor is Coming
 
Advanced Blogging
Advanced BloggingAdvanced Blogging
Advanced Blogging
 
Puertos De Comunicacion
Puertos De ComunicacionPuertos De Comunicacion
Puertos De Comunicacion
 
Análisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimidoAnálisis exergético de sistemas industriales de aire comprimido
Análisis exergético de sistemas industriales de aire comprimido
 
Scavenger Hunt Collage
Scavenger Hunt CollageScavenger Hunt Collage
Scavenger Hunt Collage
 
Smc073 11 april 2012 Vught
Smc073 11 april 2012 VughtSmc073 11 april 2012 Vught
Smc073 11 april 2012 Vught
 
Moss Week 12 Final With Answers
Moss   Week 12   Final   With AnswersMoss   Week 12   Final   With Answers
Moss Week 12 Final With Answers
 
Wood
WoodWood
Wood
 
side_face samples
side_face samplesside_face samples
side_face samples
 
911 Jour 1
911  Jour 1911  Jour 1
911 Jour 1
 
Management Final Project Fall 2008
Management Final Project Fall 2008Management Final Project Fall 2008
Management Final Project Fall 2008
 
LambdaDay: Backbone.js
LambdaDay: Backbone.jsLambdaDay: Backbone.js
LambdaDay: Backbone.js
 
Zipmark product and market overview
Zipmark product and market overviewZipmark product and market overview
Zipmark product and market overview
 
E learners presentation 2010
E learners presentation 2010E learners presentation 2010
E learners presentation 2010
 

Ähnlich wie C Sharp Lecture Johan Franzen

Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1Little Tukta Lita
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
Lecture 4: Data Types
Lecture 4: Data TypesLecture 4: Data Types
Lecture 4: Data TypesEelco Visser
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr-archana-dhawan-bajaj
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfacesmelpon
 
An Introduction to Part of C++ STL
An Introduction to Part of C++ STLAn Introduction to Part of C++ STL
An Introduction to Part of C++ STL乐群 陈
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpvoegtu
 

Ähnlich wie C Sharp Lecture Johan Franzen (20)

TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
 
C++11
C++11C++11
C++11
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 
Lezione03
Lezione03Lezione03
Lezione03
 
Lezione03
Lezione03Lezione03
Lezione03
 
Lecture 4: Data Types
Lecture 4: Data TypesLecture 4: Data Types
Lecture 4: Data Types
 
C#
C#C#
C#
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
Python tour
Python tourPython tour
Python tour
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Why Learn Python?
Why Learn Python?Why Learn Python?
Why Learn Python?
 
Dr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slidesDr archana dhawan bajaj - csharp fundamentals slides
Dr archana dhawan bajaj - csharp fundamentals slides
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Boost.Interfaces
Boost.InterfacesBoost.Interfaces
Boost.Interfaces
 
An Introduction to Part of C++ STL
An Introduction to Part of C++ STLAn Introduction to Part of C++ STL
An Introduction to Part of C++ STL
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 

Kürzlich hochgeladen

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
🐬 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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 

Kürzlich hochgeladen (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 

C Sharp Lecture Johan Franzen

  • 1. The C# Language Johan Franzén C# – Overview Panel 1 Panel 2 Object Oriented (similar to Java) Appeared in 2001 .NET Platform (VB.NET, J#, Managed C++ and more) Microsoft Windows Linux and Mac OS X with the mono project 1
  • 2. C# – Common Language Infrastructure Panel 1 Panel 2 C# – Hello World Panel 2 using System; class Hello { static void Main() { Console.WriteLine(quot;Hello Console.WriteLine(quot;Hello worldquot;); } } 2
  • 3. C# – Data types int Panel 2 float string byte bool . . . float fValue = 2.0f; double dValue = 2.0; bool bValue = 5 (incorrect) C# – Value Types and Reference Types Panel 1 Panel 2 Value Types Value Type Point is a Struct By Value (copy) Point p1 = new Point(); Point p2 = p1; int, float, … , Point, Vector2 (structs) (p2 is a copy of p1) Reference Types By Reference (reference) Reference Type Classes Person is a Class Person p1 = new Person(); Person(); Person p2 = p1; (p2 points to the same object as p1) 3
  • 4. C# – Array & List Array (fixed size) int[] int[] myArray = new int[10]; int[10]; myArray[2] myArray[2] = 3; List (can grow) List<int> List<int> myList = new List<int>(); List<int>(); myList.Add(3); myList.Add(3); int myValue = myList[0]; myList[0]; C# – Iteration Standard for loop o for( t y st Cou tt; myList.Count; for(int i = 0; i < myList.Count; i++) { ) Console.WriteLine(myList[ Console.WriteLine(myList[i]); } foreach loop foreach( foreach(int value in myList) { myList) Console.WriteLine( l ) Console.WriteLine(value); C l W it Li (value); } 4
  • 5. C# – get/set methods Java Panel 1 ------------------------------------------------ class Person { private int age; public int getAge() { return age; } getAge() public void setAge(int value) { setAge( if(age if(age >= 0) age = value; } } ------------------------------------------------ Person p = new Person(); Person(); p.setAge(20); p.setAge(20); int age = p.getAge(); p.getAge(); C# – Properties C# Panel 1 Panel 2 ------------------------------------------------ class Person { private int age; public int Age { get { return age; } set { if(age if(age >= 0) age = value; value; } } } ------------------------------------------------ Person p = new Person(); Person(); p.Age = 20; int age = p.Age; p.Age; 5
  • 6. ACTION 6