©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 1
Introduction to C#
Lee Englestone, Developer Relations Lead
Audience: Women In Software Engineering (WISE)
Date: October 2023
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 2
Contents
2. What?
What is C#?
3. How?
How does it work?
4. Why?
Why use C#?
5. Try it!
Try it for yourself!
6. Summary
More information
and next steps
1. Introduction
Hi there 👋
3
About Me
VisualStudioTips.co.uk
Start-Coding.com
HackathonTips.com
GoodBusinessBooks.com
Many, many more..
Follow me on Engage!
Lee Englestone, Grp Mgr
Developer Relations Lead
20+ years Software Developer
4x Microsoft MVP
MSc Entrepreneurship Management & Innovation
4
EmTech &
Open Innovation
OCTO
(Office of the CTO)
EmTech
(Emerging Technology)
Open Innovation
Developer Relations
GSA (Global Solution Area)
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 5
What is C#?
• Programming language
• Free & easy (and tooling)
• Cross platform
• Wide range of uses https://try.dot.net/
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 6
.NET Framework
• Programming Languages
• Class Libraries
• Runtime
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 7
C# Everywhere
Gaming
Desktop/
Laptops
applications
Web & Cloud
IoT
Tablets
iOS & Android phones
Virtual Reality
Augmented Reality
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 8
Popularity
C# is a very popular programming language
https://survey.stackoverflow.co/2023/#technology
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 9
Example Application Types
Console Application
Simple, powerful, basic UI & Input
Web Application
Typical website
Windows Application
Think Calculator app
Windows Service
No UI, runs in the background
Azure Cloud Function
Simple scalable app in the cloud
Web API
Web Application Programming
Interface – A callable web service
Mobile App
To run on mobile phones / tables
Game
A 2D or 3D game
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 10
My example side projects that use C#
XamarinARKit.com
11
A look at C#
• Variables & data types
• Logic control
• Building blocks
• Namespaces
You can follow along on try.dot.net
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 12
Variables
Storing temporary items of information
Can use built-in data types or user defined data types
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 13
String
Declaration, manipulation and concatenation
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 14
Boolean
true or false
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 15
Numbers
Various min / max sizes and precision
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 16
Numbers Continued
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 17
DateTime
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 18
Control statements
Don’t always want..
Do A, then B, then C, then D
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 19
Collections, Lists, Arrays etc
Storing collections of variables in a variable
Array List Dictionary
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 20
Loops & Iterations
Doing things multiple times
foreach
for for while do do while
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 21
User defined types
Define your own types by combining existing types
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 22
Properties and Methods
Both built in types and user defined types
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 23
Common Namespaces
System
System.Math
System.Text
System.File
System.Globalisation
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 24
Exercise: How many Tuesdays are there in 2023?
• Start with a date on 1st of January 2023
• Have an int counter
• Loop until 2024
• Each day check if day is a Tuesday
• If so, increment a counter
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 25
Exercise: What are the dates of all the Tuesdays in 2023?
• Same, but add the date to a collection
• Iterate through collection and display them
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 26
Tooling
Visual Studio
https://visualstudio.microsoft.com/#vs-section
Visual Studio Code
https://visualstudio.microsoft.com/#vscode-section
LinqPad
https://www.linqpad.net/
Rider
https://www.jetbrains.com/rider/
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 27
In Browser Tutorial
https://dotnet.microsoft.com/en-us/learn/dotnet/in-browser-tutorial/1
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 28
Try it out yourself
Try .NET page
https://dotnet.microsoft.com/en-us/platform/try-dotnet
In browser tutorial
https://dotnet.microsoft.com/en-us/learn/dotnet/in-browser-tutorial/1
Try anything
https://try.dot.net/
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential> 29
Summary
2. What?
What is C#?
3. How?
How does it work?
4. Why?
Why use C#?
5. Try it!
Try it for yourself!
6. Summary
More information
and next steps
1. Introduction
Hi there 👋
©2022 Avanade Inc. All Rights Reserved. <Highly Confidential>
Questions?

Introduction to C#

  • 1.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 1 Introduction to C# Lee Englestone, Developer Relations Lead Audience: Women In Software Engineering (WISE) Date: October 2023
  • 2.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 2 Contents 2. What? What is C#? 3. How? How does it work? 4. Why? Why use C#? 5. Try it! Try it for yourself! 6. Summary More information and next steps 1. Introduction Hi there 👋
  • 3.
    3 About Me VisualStudioTips.co.uk Start-Coding.com HackathonTips.com GoodBusinessBooks.com Many, manymore.. Follow me on Engage! Lee Englestone, Grp Mgr Developer Relations Lead 20+ years Software Developer 4x Microsoft MVP MSc Entrepreneurship Management & Innovation
  • 4.
    4 EmTech & Open Innovation OCTO (Officeof the CTO) EmTech (Emerging Technology) Open Innovation Developer Relations GSA (Global Solution Area)
  • 5.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 5 What is C#? • Programming language • Free & easy (and tooling) • Cross platform • Wide range of uses https://try.dot.net/
  • 6.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 6 .NET Framework • Programming Languages • Class Libraries • Runtime
  • 7.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 7 C# Everywhere Gaming Desktop/ Laptops applications Web & Cloud IoT Tablets iOS & Android phones Virtual Reality Augmented Reality
  • 8.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 8 Popularity C# is a very popular programming language https://survey.stackoverflow.co/2023/#technology
  • 9.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 9 Example Application Types Console Application Simple, powerful, basic UI & Input Web Application Typical website Windows Application Think Calculator app Windows Service No UI, runs in the background Azure Cloud Function Simple scalable app in the cloud Web API Web Application Programming Interface – A callable web service Mobile App To run on mobile phones / tables Game A 2D or 3D game
  • 10.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 10 My example side projects that use C# XamarinARKit.com
  • 11.
    11 A look atC# • Variables & data types • Logic control • Building blocks • Namespaces You can follow along on try.dot.net
  • 12.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 12 Variables Storing temporary items of information Can use built-in data types or user defined data types
  • 13.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 13 String Declaration, manipulation and concatenation
  • 14.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 14 Boolean true or false
  • 15.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 15 Numbers Various min / max sizes and precision
  • 16.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 16 Numbers Continued
  • 17.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 17 DateTime
  • 18.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 18 Control statements Don’t always want.. Do A, then B, then C, then D
  • 19.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 19 Collections, Lists, Arrays etc Storing collections of variables in a variable Array List Dictionary
  • 20.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 20 Loops & Iterations Doing things multiple times foreach for for while do do while
  • 21.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 21 User defined types Define your own types by combining existing types
  • 22.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 22 Properties and Methods Both built in types and user defined types
  • 23.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 23 Common Namespaces System System.Math System.Text System.File System.Globalisation
  • 24.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 24 Exercise: How many Tuesdays are there in 2023? • Start with a date on 1st of January 2023 • Have an int counter • Loop until 2024 • Each day check if day is a Tuesday • If so, increment a counter
  • 25.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 25 Exercise: What are the dates of all the Tuesdays in 2023? • Same, but add the date to a collection • Iterate through collection and display them
  • 26.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 26 Tooling Visual Studio https://visualstudio.microsoft.com/#vs-section Visual Studio Code https://visualstudio.microsoft.com/#vscode-section LinqPad https://www.linqpad.net/ Rider https://www.jetbrains.com/rider/
  • 27.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 27 In Browser Tutorial https://dotnet.microsoft.com/en-us/learn/dotnet/in-browser-tutorial/1
  • 28.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 28 Try it out yourself Try .NET page https://dotnet.microsoft.com/en-us/platform/try-dotnet In browser tutorial https://dotnet.microsoft.com/en-us/learn/dotnet/in-browser-tutorial/1 Try anything https://try.dot.net/
  • 29.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> 29 Summary 2. What? What is C#? 3. How? How does it work? 4. Why? Why use C#? 5. Try it! Try it for yourself! 6. Summary More information and next steps 1. Introduction Hi there 👋
  • 30.
    ©2022 Avanade Inc.All Rights Reserved. <Highly Confidential> Questions?

Editor's Notes

  • #3 A number of things not covered
  • #8 Websites Cloud services Games Machine Learning & AI VR & AR Windows Applications Mobile Apps IOT
  • #9 Stack Overflow survey
  • #10 Console Application Web Application Windows Application Windows Service Cloud Function Mobile App
  • #14  string mySentence = "Hello World"; Console.WriteLine(mySentence); Console.WriteLine(mySentence.Length); Console.WriteLine(mySentence.ToUpper()); Console.WriteLine(mySentence.ToLower()); Console.WriteLine(mySentence.Replace(" ", "-")); Console.WriteLine(mySentence + " it's sunny outside");
  • #15  string mySentence = "Hello World"; Console.WriteLine(mySentence); Console.WriteLine(mySentence.Length); Console.WriteLine(mySentence.ToUpper()); Console.WriteLine(mySentence.ToLower()); Console.WriteLine(mySentence.Replace(" ", "-")); Console.WriteLine(mySentence + " it's sunny outside");
  • #17 int number1 = 10; int number2 = 25; int number3 = number1 + number2; Console.WriteLine(number3); int whole1 = 13; int whole2 = 2; int whole3 = whole1/whole2; Console.WriteLine(whole3); Console.WriteLine(int.MaxValue); Console.WriteLine(long.MaxValue); nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred seven
  • #18 DateTime date1 = new DateTime(); DateTime birthday = new DateTime(1982, 11, 8, 0, 0,0); DateTime now = DateTime.Now; DateTime thisTimeTomorrow = DateTime.Now.AddDays(1); Console.WriteLine(date1); Console.WriteLine(birthday); Console.WriteLine(now); Console.WriteLine(thisTimeTomorrow); Console.WriteLine(birthday.ToString("dd MMMM yyyy"));
  • #19 var today = DateTime.Now; Console.WriteLine(today.ToString("ddd dd MM yyyy")); if(today.DayOfWeek == DayOfWeek.Saturday || today.DayOfWeek == DayOfWeek.Sunday) {     Console.WriteLine("It's the weekend!"); } else {     Console.WriteLine("It's NOT the weekend"); }
  • #20  string[] names = new string[4]; names[0] = "Marie"; names[1] = "Amber"; names[2] = "Farooq"; names[3] = "Sam"; Console.WriteLine(names.Length); Console.WriteLine(names[1]); List<int> ages = new List<int>(); ages.Add(30); ages.Add(50); ages.Add(32); ages.Add(48); Console.WriteLine(ages.Count()); Console.WriteLine(ages[1]); Console.WriteLine(ages.Sum()); Console.WriteLine(ages.Average());
  • #30 A number of things not covered