Explore .NET and C#

We've explored server-side programming with JavaScript, but there are many other options out there. In this assignment, we're going to take a look at working in .NET and C#.

There won't be a lot of information here on exactly what you should do: the intention is for to practice learning new technology on your own.

You should work through this assignment yourself, but check in with your group as you go to share what you are learning, useful resources, and ask questions.

.NET vs. C#

.NET is a framework and runtime that works with the C# language. When researching .NET, you may often come across documentation that refers to both .NET and C#. For the purposes of this assignment, you can consider these two terms to be part of one same single technology.

See https://stackoverflow.com/q/2724864/830030

VSCode

While there are many different code editors which work well with .NET and C#, please continue to use VSCode.

Objectives

  • install tools required to work with a new language
  • explore basic syntax (variables, types, data structures, loops, conditionals, functions) of new language
  • solve logic problems in a new language

Setup and Hello World

You will need to install .NET and get it up and running on your computer. It is a programming convention to always start learning a new technology by creating a Hello World application: this is a program that logs the string "Hello World" to your terminal. In other words, it's the simplest possible thing you can make, but enough to prove that you can execute code in that language.

Google is your friend for this assignment! For example, try searching for:

  • Install .net mac
  • .net getting started
  • .net hello world tutorial

NOTE: If you have M1 you will want the ARM64 installer, and if you have intel you'll want x64 installer!

Make a new file hello-world.cs and commit your code, which logs the string "Hello World" to your terminal.

Our next step is to understand the basic syntax and structure of .NET and C#, including:

  • Variables, numbers, and data types
  • Conditionals
  • Loops and arrays (aka "lists")
  • Data structures
  • Functions

Think of this like a super-compressed version of Tier 1, for C#!

Starting Points

Microsoft has some great places to get started with the language and runtime:

The Goal

Our end goals is to be able to complete a few code "katas". These are small coding exercises to help you build up skills in a language.

To get there, here is a checklist of things you can make sure you can do! Show your exploration and work in your hello-world.cs file.

BASE

  • Make a string
  • Make a number (what kind? There are multiple!)
  • Make a boolean
  • Make an if/else if/else block
  • Make a switch block
  • Make an array of strings
  • Make a for loop
    • Log each item
  • Make a class (object structure)
    • Instantiate a class (make a new object)
  • Make a method (function, in a class)
    • Return a value
    • Call from instance of class

STRETCH

  • Make an array of objects
  • Loop over array of objects
  • Use a List instead of an array
  • Use a foreach loop

Code Katas

For this assignment you will need to complete the following katas from codewars.com:

You may solve these online on codewars.com, but please copy your solutions into new files in your repo.

STRETCH

Find and complete 2-3 additional code katas on codewars.com:

https://www.codewars.com/kata/search/csharp?q=&r[]=-8&beta=false&order_by=popularity%20desc