Introduction to C#
Module Overview
C# (pronounced “C-sharp”) is a modern, object-oriented programming language developed by Microsoft as part of its .NET framework in the early 2000s.
It is designed for building a wide range of applications, including desktop applications, web applications, games, and mobile apps.
LEARNING OUTCOMES
• Understand the Basics of C#
• Write Basic C# Programs
• Control Program Flow
• Work with Functions / Methods
• Apply Object-Oriented Programming (OOP)
• Handle Data Collections
• Debug and Test Code
• Develop Simple Applications
Unit 1: Understanding the Web and C#
C# (C-Sharp) is a modern, object-oriented programming language developed by Microsoft.
When it comes to web development, C# is primarily used for server-side programming, meaning it runs on a web server to process requests, manage data, and generate dynamic content.
KEY TERMS
• C# (C-Sharp) – A modern, object-oriented programming language developed by Microsoft for building web, desktop, mobile, and game applications.
• Variable – A container used to store data that can change during program execution.
• Data Types – Specifies the type of data a variable can hold:
int → integer numbers
float → decimal numbers
double → double-precision decimal numbers
char → single character
string → sequence of characters
bool → true or false
• Constant – A value that cannot change after declaration.
• Operator – Symbols used to perform operations on variables or values, e.g., +, -, *, /, %, ==.
• Method / Function – A block of code that performs a specific task.
• Loop – Repeats a block of code multiple times: for, while, do-while.
• Conditional Statement –Executes code based on conditions: if, else if, else, switch.
• Class – Blueprint for creating objects. Contains attributes (fields) and methods.
• Object – An instance of a class.
• Namespace – A container that holds classes and prevents naming conflicts.
• Console – A class used for input/output operations in a console application.
• Array – A collection of elements of the same type stored in a single variable.
• Property – A member of a class that provides controlled access to fields.
• Constructor – A special method used to initialize objects when they are created.
• Exception / Error Handling –Mechanism to handle runtime errors using try, catch, and finally.
• Static – A keyword to declare members that belong to the class rather than an object.
• Interface – Defines a contract that classes can implement.
• Inheritance – Allows a class to inherit attributes and methods from another class.
• Encapsulation – Restricting access to class members using access modifiers (private, public, protected).
Unit 2: C# Document Structure
C# program is typically saved with a .cs file extension and follows a structured format. Understanding this structure helps in writing organized and maintainable code.
CORE STRUCTURE COMPONENTS
• Namespace
• Class
• Main Method
• Variables and Constants
• Statements and Expressions
• Methods / Functions
• Conditional Statements
• Loops
• Comments
Unit 3: Text and Content Elements
In C#, text and content elements are mainly used to display information to users, receive input, and manipulate text. These are essential for creating interactive programs and applications.
COMMON TEXT ELEMENTS
• Comments in C#
• Text Elements in C#
• Content Elements in C#
hover any card → interactive glow, shift, and icons respond