💻

Introduction to C# Programming Language

Jun 3, 2025

C# Programming Language Overview

Introduction

  • C# is a simple, modern, general-purpose, object-oriented programming language.
  • Developed by Microsoft within its .NET initiative.
  • Covers both basic and advanced C# programming concepts.

Audience

  • Designed for beginners to understand the basics of C# programming.

Prerequisites

  • Based on C and C++ languages.
  • Helpful to have a basic understanding of C or C++.

Disclaimer

  • Content is copyrighted by Tutorials Point.
  • Reuse, distribution, or republication is prohibited without written consent.

Table of Contents

  1. Overview
    • Strong Programming Features of C#
  2. Environment
    • The .Net Framework
    • Integrated Development Environment (IDE) for C#
    • Writing C# Programs on Linux or Mac OS
  3. Program Structure
    • Creating Hello World Program
    • Compiling and Executing the Program
  4. Basic Syntax
  5. Data Types
    • Value Type
    • Reference Type
    • Object Type
    • Dynamic Type
    • String Type
    • Pointer Type

Overview of C#

  • Modern, general-purpose, object-oriented.
  • Developed by Anders Hejlsberg for the .Net Framework.
  • Designed for Common Language Infrastructure (CLI).
  • Widely used for being simple, efficient, and part of the .Net Framework.

Strong Programming Features

  • Boolean conditions, automatic garbage collection, standard library.
  • Assembly versioning, properties, events, delegates, generics.
  • Multithreading, LINQ, lambda expressions.

Environment

The .Net Framework

  • Revolutionary platform supporting Windows applications, web applications, and web services.
  • Multi-platform capabilities with languages like C#, C++, Visual Basic, and more.
  • Components: CLR, .Net Framework Class Library, Windows Forms, ASP .Net, LINQ, etc.

Integrated Development Environment (IDE) for C#

  • Tools: Visual Studio, Visual C# Express, Visual Web Developer.
  • Visual C# Express and Visual Web Developer are available for free.

Writing C# Programs on Linux or Mac OS

  • Mono is an open-source version of the .NET Framework.
  • Allows running Microsoft .NET applications cross-platform.

Program Structure

Hello World Program

  • Key components: Namespace declaration, class, class methods, Main method, statements, comments.
  • Example provided with explanation of each part.

Compiling and Executing the Program

  • Steps using Visual Studio: New project creation, code writing, and execution.
  • Command-line compilation and execution explained.

Basic Syntax

Important Components

  • Using Keyword: Includes namespaces in the program.
  • Class Keyword: Declares a class.
  • Comments: Used to explain code.

Member Variables and Functions

  • Variables: Attributes or data members of a class.
  • Functions: Set of statements performing specific tasks.

Identifiers and Keywords

  • Rules for naming classes, variables, and functions.
  • Keywords are reserved words predefined to the C# compiler.

Data Types

Value Type

  • Directly assigned values, derived from System.ValueType.
  • Examples: int, char, float.
  • Use sizeof method to get the exact size.

Reference Type

  • Contains a reference to the variables.
  • Examples: object, dynamic, string.

Object, Dynamic, String Types

  • Object type: Base class for all data types, needs type conversion.
  • Dynamic type: Runtime type-checking.

Pointer Type

  • Stores the memory address of another type.
  • Similar to pointers in C or C++.

This summary captures the main topics and detailed explanations for supporting the learning process of C# programming as presented in the tutorial.