From 1f722d197c938e7b917ce91e6440bc57482e6058 Mon Sep 17 00:00:00 2001 From: katiesavage Date: Thu, 28 Apr 2022 15:20:11 -0700 Subject: [PATCH 1/9] C# crash course outline --- 2-csharp/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2-csharp/README.md diff --git a/2-csharp/README.md b/2-csharp/README.md new file mode 100644 index 0000000..7d75973 --- /dev/null +++ b/2-csharp/README.md @@ -0,0 +1,29 @@ +# C# Crash Course + +## Topics you'll learn +* Language attributes + * Compiled languages +* Syntax basics + * Keywords + * Accessing methods + * Parameters + * Semicolons + * Data types + * Variables + * Arithmetic operators + * Booleans +* Object Oriented Programming + * Records + * Objects + * Properties + * Methods + +## Let's get into it! +blah blah blah + +## Mini Challenges! +| # | Challenge | Solution | Duration | What you will learn | More information | +|-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | +1 | [Hello World](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | +2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [Numberic Types](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/numbers-in-csharp?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | +3 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | \ No newline at end of file From 44559eefe5ccac045d5bb637b70ce8360373a4d5 Mon Sep 17 00:00:00 2001 From: katiesavage Date: Thu, 28 Apr 2022 15:53:48 -0700 Subject: [PATCH 2/9] added descriptions and ways to connect --- 2-csharp/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 7d75973..a74c982 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -1,5 +1,7 @@ # C# Crash Course +In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps in emails 3, 4, and 5! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. At the end, we'll link you to some quick in-browser C# challenges so you can apply these concepts. + ## Topics you'll learn * Language attributes * Compiled languages @@ -22,8 +24,20 @@ blah blah blah ## Mini Challenges! +Each of these mini challenges is designed so that you can apply C# concepts to mini coding exercises. These challenges are all sourced from Microsoft documentation and will allow you to get coding inside your browser. Easy peasy! + | # | Challenge | Solution | Duration | What you will learn | More information | |-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | 1 | [Hello World](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | 2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [Numberic Types](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/numbers-in-csharp?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -3 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | \ No newline at end of file +3 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | + + +## Bonus and more ways to connect + +Want more practice with C#? The .NET team has you covered. Here's a few learning resources: +* C# Video Series on [Microsoft Docs](https://docs.microsoft.com/shows/CSharp-101/?WT.mc_id=dotnet-35129-website) or [YouTube](https://www.youtube.com/watch?v=Z5JS36NlJiU) +* Self Guided Tutorials on [Microsoft Learn](https://docs.microsoft.com/users/dotnet/collections/yz26f8y64n7k07) +* [Learn to Code Page](https://dotnet.microsoft.com/learntocode) + +Connect with us! Check out the [.NET Community Page](https://dotnet.microsoft.com/platform/community) to find links to our blogs, YouTube, Twitter, and more. \ No newline at end of file From d16ddfcf6cf561e4f3e20113d39f363a511cb613 Mon Sep 17 00:00:00 2001 From: katiesavage Date: Fri, 29 Apr 2022 11:52:27 -0700 Subject: [PATCH 3/9] adding syntax basics --- 2-csharp/README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index a74c982..46182e5 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -4,6 +4,7 @@ In this C# Crash Course, we'll go over the basics of C# so that you'll be ready ## Topics you'll learn * Language attributes + * Strongly typed * Compiled languages * Syntax basics * Keywords @@ -20,10 +21,36 @@ In this C# Crash Course, we'll go over the basics of C# so that you'll be ready * Properties * Methods -## Let's get into it! -blah blah blah +# Let's get into it! +## Language Attributes +C# is a strongly typed, compiled, object oriented language. Let's break this down. +* In a **strongly typed** language, every variable has a defined type. Every method declaration specifies a name, the type and kind for each input parameter and for the return value. +* A **compiler** converts the code you write into a format that your computer can understand.After you write C# and build it, the C# compiler (called Roslyn) will analyze your code to check for any errors. -## Mini Challenges! +## Syntax Basics +Here's a piece of code that will print "Hello world!" to the console. + +```csharp +using System; + +Console.WriteLine("Hello world!"); +``` +### Keywords +With C#, you use **keywords** like *using* and *Console*. +>Keywords are predefined, reserved identifiers that have special meanings to the compiler. + +### Accessing methods +The Dot in *Console.WriteLine* allows us to access methods and properties. In this example, **Console** is a type that represents the console window. **WriteLine** is a method of the Console type that prints a line of text to that text console. + +### Parameters + + +... +## OOP +C# is an object-oriented language. You define types and their behavior. +... + +# Mini Challenges! Each of these mini challenges is designed so that you can apply C# concepts to mini coding exercises. These challenges are all sourced from Microsoft documentation and will allow you to get coding inside your browser. Easy peasy! | # | Challenge | Solution | Duration | What you will learn | More information | @@ -33,7 +60,7 @@ Each of these mini challenges is designed so that you can apply C# concepts to m 3 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | -## Bonus and more ways to connect +# Bonus and more ways to connect Want more practice with C#? The .NET team has you covered. Here's a few learning resources: * C# Video Series on [Microsoft Docs](https://docs.microsoft.com/shows/CSharp-101/?WT.mc_id=dotnet-35129-website) or [YouTube](https://www.youtube.com/watch?v=Z5JS36NlJiU) From 363f98823dd4f7e1415ffb77a9dad094076e2cd2 Mon Sep 17 00:00:00 2001 From: katiesavage Date: Fri, 29 Apr 2022 15:41:17 -0700 Subject: [PATCH 4/9] done with basics --- 2-csharp/README.md | 143 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 114 insertions(+), 29 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 46182e5..70de29a 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -1,33 +1,30 @@ # C# Crash Course -In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps in emails 3, 4, and 5! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. At the end, we'll link you to some quick in-browser C# challenges so you can apply these concepts. +In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps in emails 3, 4, and 5! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. In each section, we'll link you to some quick in-browser C# challenges so you can apply these concepts. ## Topics you'll learn * Language attributes - * Strongly typed - * Compiled languages * Syntax basics - * Keywords - * Accessing methods - * Parameters - * Semicolons - * Data types - * Variables - * Arithmetic operators - * Booleans * Object Oriented Programming - * Records - * Objects - * Properties - * Methods -# Let's get into it! -## Language Attributes +--- + +# Language attributes C# is a strongly typed, compiled, object oriented language. Let's break this down. -* In a **strongly typed** language, every variable has a defined type. Every method declaration specifies a name, the type and kind for each input parameter and for the return value. -* A **compiler** converts the code you write into a format that your computer can understand.After you write C# and build it, the C# compiler (called Roslyn) will analyze your code to check for any errors. +## Strongly typed + In a **strongly typed** language, every variable has a defined type. Some of these types include: + * String, "Hello world!" + * Char, 'a' + * int, 3 + * decimal, 1.5 + * bool, True -## Syntax Basics +## Compiler + A **compiler** converts the code you write into a format that your computer can understand.After you write C# and build it, the C# compiler (called Roslyn) will analyze your code to check for any errors. + +--- + +# The basics Here's a piece of code that will print "Hello world!" to the console. ```csharp @@ -35,20 +32,107 @@ using System; Console.WriteLine("Hello world!"); ``` -### Keywords +## Keywords With C#, you use **keywords** like *using* and *Console*. ->Keywords are predefined, reserved identifiers that have special meanings to the compiler. +**Keywords** are predefined, reserved identifiers that have special meanings to the compiler. -### Accessing methods +## Accessing methods The Dot in *Console.WriteLine* allows us to access methods and properties. In this example, **Console** is a type that represents the console window. **WriteLine** is a method of the Console type that prints a line of text to that text console. -### Parameters +## Parameters +In this example, we use parentheses pass a string as a parameter to *Console.WriteLine*. +## Variables + In C#, **variables** allow you to temporarily store a value in memory. In C#, you must declare a vaiable before using it. + ```csharp + var cSharp = "really cool"; + ``` + In this example, we created a string called *cSharp*. You can use the var keyword to declare local variables without explicitly giving them a type. + + Variable names can contain alphanumeric characters and underscores, but no special characters. They also cannot be keywords. -... -## OOP -C# is an object-oriented language. You define types and their behavior. -... +## Syntax cheat sheet +1. Every statement is ended by a semicolon + ```csharp + Console.WriteLine("there is a ';' at the end of this statement"); + ``` +1. You can make comments by using 2 slashes + ```csharp + // this is a comment is C# + ``` +1. C# is case sensitive! For example, a variable "cat" is completely different from a variable "CAT". + ```csharp + var cat = "meow"; + var CAT = "rawr"; + ``` + +1. Arithmetic operators + These are probably familiar to you! + | symbol | what it does | + | --- | ------ | + | + | addition | + | - | subtraction | + | * | multiplication | + | / | division | + | % | remainder | + | ++ | increment | + | -- | decrement | + +2. Boolean expressions + We use booleans to compare two or more things. + | symbol | what it does | + | --- | ------ | + | < | less than | + | > | greater than | + | <= | less than or equal | + | >= | greater than or equal | + | == | equal | + | != | not equal | + +--- + +# OOP +C# is an object-oriented language. +Objects are defined by **Classes**. In other words, an **Object** is an instance of a class. +One way to think about this is that a class is like the blue prints for a house. The actual house that is built is an objects because it is an instance of this blue print. + +Objects inherently have attributes. In C# we call these **properties**. The attributes of a house may be the number of doors, what color the house is painted, etc. + +We can also define **methods** which describe what an object can do. For example, you can sell your house. + +Let's look at an example House class: +```csharp +// The namespace declaration provides a way to logically organize your classes +namespace Classes; + +public class House +{ + // House properties + public string Address { get; } + public int Size { get;} + + // House methods + public void SellHouse(decimal amount, DateTime date) + { + } +} +``` +We can define a **constructor** to allow us to create new House objects. + +```csharp +public House(string address, int squareFeet) +{ + this.Address = address; + this.Size = squareFeet; +} +``` +When we create an object with **new** this constructor will be called. +```csharp +using Classes; + +// Let's create a 1500 square foot house on Candy Cane Lane +var house = new House("123 Candy Cane Lane", 1500); +``` # Mini Challenges! Each of these mini challenges is designed so that you can apply C# concepts to mini coding exercises. These challenges are all sourced from Microsoft documentation and will allow you to get coding inside your browser. Easy peasy! @@ -57,7 +141,8 @@ Each of these mini challenges is designed so that you can apply C# concepts to m |-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | 1 | [Hello World](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | 2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [Numberic Types](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/numbers-in-csharp?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -3 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | +3 | [Operating on Numbers](https://docs.microsoft.com/learn/modules/csharp-basic-operations/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-basic-operations/6-solution)| 2 min | ints, decimals | [Link](...) | +4 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | # Bonus and more ways to connect From b9708c29f5d57730ae2deeb0b251ff2cf288d8f6 Mon Sep 17 00:00:00 2001 From: katiesavage Date: Fri, 29 Apr 2022 16:42:35 -0700 Subject: [PATCH 5/9] added more headers & challenges --- 2-csharp/README.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 70de29a..5c20db9 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -51,22 +51,25 @@ In this example, we use parentheses pass a string as a parameter to *Console.Wri Variable names can contain alphanumeric characters and underscores, but no special characters. They also cannot be keywords. -## Syntax cheat sheet -1. Every statement is ended by a semicolon +# Syntax cheat sheet +## Semicolons + Every statement is ended by a semicolon ```csharp Console.WriteLine("there is a ';' at the end of this statement"); ``` -1. You can make comments by using 2 slashes +## Comments + You can make comments by using 2 slashes ```csharp // this is a comment is C# ``` -1. C# is case sensitive! For example, a variable "cat" is completely different from a variable "CAT". +## Case sensitive + C# is case sensitive! For example, a variable "cat" is completely different from a variable "CAT". ```csharp var cat = "meow"; var CAT = "rawr"; ``` -1. Arithmetic operators +## Arithmetic Operators These are probably familiar to you! | symbol | what it does | | --- | ------ | @@ -78,7 +81,7 @@ In this example, we use parentheses pass a string as a parameter to *Console.Wri | ++ | increment | | -- | decrement | -2. Boolean expressions +## Boolean expressions We use booleans to compare two or more things. | symbol | what it does | | --- | ------ | @@ -91,11 +94,12 @@ In this example, we use parentheses pass a string as a parameter to *Console.Wri --- -# OOP +# Object Oriented Programming C# is an object-oriented language. Objects are defined by **Classes**. In other words, an **Object** is an instance of a class. One way to think about this is that a class is like the blue prints for a house. The actual house that is built is an objects because it is an instance of this blue print. +## Properties and methods Objects inherently have attributes. In C# we call these **properties**. The attributes of a house may be the number of doors, what color the house is painted, etc. We can also define **methods** which describe what an object can do. For example, you can sell your house. @@ -117,6 +121,7 @@ public class House } } ``` +## Constructor We can define a **constructor** to allow us to create new House objects. ```csharp @@ -140,9 +145,9 @@ Each of these mini challenges is designed so that you can apply C# concepts to m | # | Challenge | Solution | Duration | What you will learn | More information | |-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | 1 | [Hello World](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [Numberic Types](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/numbers-in-csharp?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -3 | [Operating on Numbers](https://docs.microsoft.com/learn/modules/csharp-basic-operations/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-basic-operations/6-solution)| 2 min | ints, decimals | [Link](...) | -4 | [Challenge](...)|[Solution](...)| 5 min | topics | [Link](...) | +2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [String formatting tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-formatting/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | +3 | [Operating on numbers](https://docs.microsoft.com/learn/modules/csharp-basic-operations/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-basic-operations/6-solution)| 2 min | ints, decimals | [Number operations tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-operations/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | +4 | [Making clean code](https://docs.microsoft.com/learn/modules/csharp-readable-code/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-readable-code/6-solution)| 5 min | topics | [C# coding conventions](https://docs.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) | [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | # Bonus and more ways to connect From 2893f50386a594527bcdd0dee2d5f57c6a02afbd Mon Sep 17 00:00:00 2001 From: katiesavage Date: Fri, 29 Apr 2022 16:45:10 -0700 Subject: [PATCH 6/9] fixed bool chart --- 2-csharp/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 5c20db9..3c6aa59 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -83,14 +83,14 @@ In this example, we use parentheses pass a string as a parameter to *Console.Wri ## Boolean expressions We use booleans to compare two or more things. - | symbol | what it does | - | --- | ------ | - | < | less than | - | > | greater than | - | <= | less than or equal | - | >= | greater than or equal | - | == | equal | - | != | not equal | + | symbol | what it does | + | --- | ---------- | + | < | less than | + | > | greater than | + | <= | less than or equal | + | >= | greater than or equal | + | == | equal | + | != | not equal | --- From fd9c08bf8457549f30cada3b07ed873a78e3f575 Mon Sep 17 00:00:00 2001 From: Katie Savage Date: Fri, 6 May 2022 10:31:46 -0700 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: James Montemagno --- 2-csharp/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 3c6aa59..6272f2d 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -1,6 +1,6 @@ # C# Crash Course -In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps in emails 3, 4, and 5! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. In each section, we'll link you to some quick in-browser C# challenges so you can apply these concepts. +In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. In each section, we'll link you to some quick in-browser C# challenges so you can apply these concepts. ## Topics you'll learn * Language attributes @@ -20,7 +20,7 @@ C# is a strongly typed, compiled, object oriented language. Let's break this dow * bool, True ## Compiler - A **compiler** converts the code you write into a format that your computer can understand.After you write C# and build it, the C# compiler (called Roslyn) will analyze your code to check for any errors. +A **compiler** converts the code you write into a format that your computer can understand. After you write C# and build it, the C# compiler (called Roslyn) will analyze your code to check for any errors. --- @@ -37,19 +37,19 @@ With C#, you use **keywords** like *using* and *Console*. **Keywords** are predefined, reserved identifiers that have special meanings to the compiler. ## Accessing methods -The Dot in *Console.WriteLine* allows us to access methods and properties. In this example, **Console** is a type that represents the console window. **WriteLine** is a method of the Console type that prints a line of text to that text console. +The `. (DOT)` in *Console.WriteLine* allows us to access methods and properties. In this example, **Console** is a type that represents the console window. **WriteLine** is a method of the Console type that prints a line of text to that text console. ## Parameters In this example, we use parentheses pass a string as a parameter to *Console.WriteLine*. ## Variables - In C#, **variables** allow you to temporarily store a value in memory. In C#, you must declare a vaiable before using it. +In C#, **variables** allow you to temporarily store a value in memory. In C#, you must declare a variable before using it. ```csharp var cSharp = "really cool"; ``` - In this example, we created a string called *cSharp*. You can use the var keyword to declare local variables without explicitly giving them a type. +In this example, we created a string called `cSharp`. You can use the var keyword to declare local variables without explicitly giving them a type. - Variable names can contain alphanumeric characters and underscores, but no special characters. They also cannot be keywords. +Variable names can contain alphanumeric characters and underscores, but no special characters. They also cannot be keywords. # Syntax cheat sheet ## Semicolons From 8639dcdc42a56b277e44ee7872f4ac8e6a2f7bac Mon Sep 17 00:00:00 2001 From: katiesavage Date: Fri, 6 May 2022 12:12:05 -0700 Subject: [PATCH 8/9] Edited wording and added emojis --- 2-csharp/README.md | 70 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index 6272f2d..bcb06b1 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -1,4 +1,4 @@ -# C# Crash Course +# C# Crash Course 🚀 In this C# Crash Course, we'll go over the basics of C# so that you'll be ready to build out exciting web apps! We'll start by going through the key attributes of C#, syntax basics, and introduce you to OOP. In each section, we'll link you to some quick in-browser C# challenges so you can apply these concepts. @@ -25,6 +25,7 @@ A **compiler** converts the code you write into a format that your computer can --- # The basics +## 🌍 Hello World Here's a piece of code that will print "Hello world!" to the console. ```csharp @@ -32,15 +33,23 @@ using System; Console.WriteLine("Hello world!"); ``` + ## Keywords -With C#, you use **keywords** like *using* and *Console*. +With C#, you use keywords like `using` and `Console`. **Keywords** are predefined, reserved identifiers that have special meanings to the compiler. ## Accessing methods -The `. (DOT)` in *Console.WriteLine* allows us to access methods and properties. In this example, **Console** is a type that represents the console window. **WriteLine** is a method of the Console type that prints a line of text to that text console. +The `. (DOT)` in `Console.WriteLine` allows us to access methods and properties. In this example, `Console` is a type that represents the console window. `WriteLine` is a method of the Console type that prints a line of text to that text console. ## Parameters -In this example, we use parentheses pass a string as a parameter to *Console.WriteLine*. +In this example, we use parentheses pass a string as a parameter to `Console.WriteLine`. + +## 🚨 Challenge 1 +Time for your first challenge! + +| # | Challenge | Solution | Duration | What you will learn | More information | +|-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | +1 | [Hello World Challenge](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | ## Variables In C#, **variables** allow you to temporarily store a value in memory. In C#, you must declare a variable before using it. @@ -51,6 +60,11 @@ In this example, we created a string called `cSharp`. You can use the var keywor Variable names can contain alphanumeric characters and underscores, but no special characters. They also cannot be keywords. +## 🚨 Challenge 2 +| # | Challenge | Solution | Duration | What you will learn | More information | +|-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | +2 | [Variables Challenge](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [String formatting tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-formatting/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | + # Syntax cheat sheet ## Semicolons Every statement is ended by a semicolon @@ -66,6 +80,8 @@ Variable names can contain alphanumeric characters and underscores, but no speci C# is case sensitive! For example, a variable "cat" is completely different from a variable "CAT". ```csharp var cat = "meow"; + ``` + ```csharp var CAT = "rawr"; ``` @@ -81,8 +97,28 @@ Variable names can contain alphanumeric characters and underscores, but no speci | ++ | increment | | -- | decrement | +## 🚨 Challenge 3 +| # | Challenge | Solution | Duration | What you will learn | More information | +|-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | +3 | [Operating on numbers challenge](https://docs.microsoft.com/learn/modules/csharp-basic-operations/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-basic-operations/6-solution)| 2 min | ints, decimals | [Number operations tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-operations/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | + +## Decision logic +In C#, you can build applications that employ decision-making logic so that your application performs different instructions based on a set of conditions. One way we do this is with an `if` statement. `if` statements are made up of three parts: +* The if keyword +* A Boolean expression between parenthesis () +* A code block defined by curly braces { } + +If there are multiple condition, you can utilize the `else if` and `else` statements. Basically, if the `if` statement fails, these other statements allow you to test against other conditions. +You can imagine this in the context of a rock⛰️-paper📃-scissors✂️ game. Imagine you chose rock⛰️. +`if` your opponent chooses scissors✂️, then you will win +`else if` your opponent also chooses rock⛰️, then you will tie +`else` your opponent chooses paper📃, then you will lose + +Each possible decision your opponent could make leads to a different outcome. + + ## Boolean expressions - We use booleans to compare two or more things. + Booleans are expressions that return either `true` or `false`. They are often used to compare two or more things. | symbol | what it does | | --- | ---------- | | < | less than | @@ -91,6 +127,11 @@ Variable names can contain alphanumeric characters and underscores, but no speci | >= | greater than or equal | | == | equal | | != | not equal | + +## 🚨 Challenge 4 +| # | Challenge | Solution | Duration | What you will learn | More information | +|-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | +4 | [Decision logic challenge](https://docs.microsoft.com/learn/modules/csharp-if-elseif-else/4-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-if-elseif-else/5-solution)| 2 min | if, else if, else, booleans | [Boolean expressions tutorial](https://docs.microsoft.com/learn/modules/csharp-evaluate-boolean-expressions/1-introduction), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | --- @@ -104,6 +145,12 @@ Objects inherently have attributes. In C# we call these **properties**. The attr We can also define **methods** which describe what an object can do. For example, you can sell your house. +To summarize these concepts using our house example, +A Class is like a blueprint 📜 +An Object is an instance of this blueprint, or a house 🏠 +The Properties of a house could be the number of doors it has or the color it's painted 🚪 🎨 +A Method of our class is that we can sell our house 💸 + Let's look at an example House class: ```csharp // The namespace declaration provides a way to logically organize your classes @@ -131,7 +178,7 @@ public House(string address, int squareFeet) this.Size = squareFeet; } ``` -When we create an object with **new** this constructor will be called. +When we create an object with `new` this constructor will be called. ```csharp using Classes; @@ -139,15 +186,14 @@ using Classes; var house = new House("123 Candy Cane Lane", 1500); ``` -# Mini Challenges! -Each of these mini challenges is designed so that you can apply C# concepts to mini coding exercises. These challenges are all sourced from Microsoft documentation and will allow you to get coding inside your browser. Easy peasy! +## The .NET Class Library +C# also has built in classes and functionality within the .NET Class Library. The .NET Class Library is a collection of thousands of classes containing tens of thousands of methods. These methods are created by Microsoft and are available for use in your applications. For example, when we called `Console.WriteLine` earlier, we were calling a method from the `System.Console` class. For a more in-depth overview, you can read up on the .NET Class Library in the [.NET documentation](https://docs.microsoft.com/dotnet/standard/class-library-overview). +## 🚨 Challenge 5 | # | Challenge | Solution | Duration | What you will learn | More information | |-| ------------------------------- | ------------------------------- | ----------- | -------------------------------------- | - | -1 | [Hello World](https://docs.microsoft.com/learn/modules/csharp-write-first/2-exercise-hello-world/?ns-enrollment-type=learningpath&ns-enrollment-id=learn.languages.csharp-first-steps)| N/A | 3 min | case sensitive, strings, comments | [Intro to C# Tutorial](https://docs.microsoft.com/dotnet/csharp/tour-of-csharp/tutorials/hello-world?WT.mc_id=csharpnotebook-35129-website), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -2 | [Variables](https://docs.microsoft.com/learn/modules/csharp-literals-variables/6-challenge )|[Solution](https://docs.microsoft.com/learn/modules/csharp-literals-variables/7-solution)| 5 min | variables, data types, strings, ints, decimals | [String formatting tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-formatting/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -3 | [Operating on numbers](https://docs.microsoft.com/learn/modules/csharp-basic-operations/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-basic-operations/6-solution)| 2 min | ints, decimals | [Number operations tutorial](https://docs.microsoft.com/learn/modules/csharp-basic-operations/), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | -4 | [Making clean code](https://docs.microsoft.com/learn/modules/csharp-readable-code/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-readable-code/6-solution)| 5 min | topics | [C# coding conventions](https://docs.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) | [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | +5 | [.NET Class Library challenge](https://docs.microsoft.com/learn/modules/csharp-call-methods/5-challenge)|[Solution](https://docs.microsoft.com/learn/modules/csharp-call-methods/6-solution)| 2 min | ints, decimals | [.NET documentation](https://docs.microsoft.com/dotnet/standard/class-library-overview), [C# documentation](https://docs.microsoft.com/dotnet/csharp/) | + # Bonus and more ways to connect From 16e4f3836a4a3c6a83ce4737a56716c136c0c4ca Mon Sep 17 00:00:00 2001 From: Katie Savage Date: Fri, 6 May 2022 12:14:23 -0700 Subject: [PATCH 9/9] Fixed layout issue --- 2-csharp/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2-csharp/README.md b/2-csharp/README.md index bcb06b1..f5ed90a 100644 --- a/2-csharp/README.md +++ b/2-csharp/README.md @@ -110,9 +110,9 @@ In C#, you can build applications that employ decision-making logic so that your If there are multiple condition, you can utilize the `else if` and `else` statements. Basically, if the `if` statement fails, these other statements allow you to test against other conditions. You can imagine this in the context of a rock⛰️-paper📃-scissors✂️ game. Imagine you chose rock⛰️. -`if` your opponent chooses scissors✂️, then you will win -`else if` your opponent also chooses rock⛰️, then you will tie -`else` your opponent chooses paper📃, then you will lose +* `if` your opponent chooses scissors✂️, then you will win +* `else if` your opponent also chooses rock⛰️, then you will tie +* `else` your opponent chooses paper📃, then you will lose Each possible decision your opponent could make leads to a different outcome. @@ -203,4 +203,4 @@ Want more practice with C#? The .NET team has you covered. Here's a few learning * Self Guided Tutorials on [Microsoft Learn](https://docs.microsoft.com/users/dotnet/collections/yz26f8y64n7k07) * [Learn to Code Page](https://dotnet.microsoft.com/learntocode) -Connect with us! Check out the [.NET Community Page](https://dotnet.microsoft.com/platform/community) to find links to our blogs, YouTube, Twitter, and more. \ No newline at end of file +Connect with us! Check out the [.NET Community Page](https://dotnet.microsoft.com/platform/community) to find links to our blogs, YouTube, Twitter, and more.