Lecture Notes on C# Introduction

Jul 7, 2024

Introduction to C# Coding

Why Learn C#?

  • Flexible Language: Useful for various applications such as console apps, web services, and games.
  • Aspiring Game Developers: Essential to learn along with C++ for game development.
  • Average Salary: Around $63,000 per year for experienced C# developers according to Glassdoor.

Getting Started with C#

Setting Up Environment

  1. IDE: Integrated Development Environment (IDE) - Software to help write other software.
  2. Recommendation: Visual Studio Community edition.
    • Download URL: Google 'Visual Studio Community' and proceed with the installation.
    • Packages Required: Check .NET desktop development; download the Unity package if interested.
    • Customizing IDE: Choose a theme; dark theme suggested for 'elite hacker' feel.
  3. Initial Setup:
    • Choose 'Continue without code' on the home screen.

Creating a C# Project

  1. New Project: File -> New Project -> C# Console Application.
  2. Naming: Name your project (e.g., 'myFirstProgram').
  3. Font Adjustment: Increase font size (e.g., to 18) via Tools -> Options -> Environment -> Fonts and Colors.
  4. Sample Code: Default 'Hello World' program provided on setup.
  5. Compiling and Running: Click the green play button at the top to run the program.

Basic Concepts and Syntax

Main Method

  • Entry point of the program: static void Main(string[] args).
  • Body enclosed in curly braces {}.
  • Example: Console.WriteLine(Hello World);