Visual Programming L1
Visual Programming L1
Hina Farooq
What is C#?
Introduction C# (pronounced as "C-Sharp") is a modern,
object-oriented, and strongly typed
to the C# programming language developed by
Microsoft.
Desktop applications (Windows Forms, WPF)
Web applications (ASP.NET MVC, Blazor)
Mobile applications (Xamarin)
Game development (Unity)
Why Learn
Easy to learn – C# C#?
has simple and clean syntax.
Object-Oriented – Helps in building modular and reusable
code.
Cross-Platform – Runs on Windows, Linux, and Mac
using .NET Core.
The Class
The Framework .NetLibrary (FCL)
Architectur
The Common Language Specification (CLS)
e and .Net
Framework
The Common Type System (CTS)
Web (ASP.NETWhat
MVC, Blazor)
Desktop is .NET?Forms, WPF)
(Windows
Mobile (Xamarin)
Cloud (Azure, AWS)
Game Development (Unity)
.NET Architecture
(FCL) Databases
Websites
Security
Network communication
Common Language Specification (CLS)
Common It defines a set of rules and restrictions that every
language must follow which runs under the . NET
Language framework.
Specification Common Type System (CTS)
(CLS) All .NET languages (like C#, VB.NET) use the same
types of data (like int, string, etc.)
Common
So, if you write code in different languages, they
Type System still work together because of CTS.
(CTS)
Garbage CLR also contains the Garbage
Collector (GC), This is a clean-up
worker.
Collection If your program uses memory but no
Visual Studio .NET is a powerful Integrated Development Environment (IDE) developed by Microsoft
for building applications using:
✅ C# and ASP.NET MVC for web applications.
✅ Windows Forms & WPF for desktop applications.
✅ Xamarin for mobile apps.
✅ Unity for game development
• Features of Visual Studio .NET IDE
• Code Editor
• Solution Explorer
• Toolbox (For GUI Applications)
• Debugging & Testing
• Database Integration
• Extensions & Plugins
Supports GitHub, Docker, Azure, AI/ML Tools for advanced development.
C# Program
Understanding the Hello World Application Code:
The first line of our program (using System;) appears in virtually all the C# programs. It gives us access to the core functionality of our computer system.
Namespaces in C#
A Namespace is simply a logical collection of related classes in C#.
The using Keyword
The using keyword above allows us to use the classes in the following ’System’ namespace.
The class Keyword
All of our C# programs contain at least one class. The Main() method resides in one of these classes. Classes are a combination of data (fields) and functions
(methods) that can be performed on this data in order to achieve the solution to our problem.
The Main() Method
static void Main(string[] args)
The Main method is the entry point of our program.The Main method is designated as static as it will be called by the Common Language Runtime (CLR) without
making any object of our HelloWorld Class (which is the definition of static methods, fields andproperties). The method is also declared void as it does not return
anything. Main is the (standard) name of this method, while string [] args is the list of parameters that can be passed to main while executing the program from
command line. We will see this later.
• Printing on the Console
Our next line prints Hello World on the
Console screen:
Console.WriteLine("Hello
World");
Here we called WriteLine(), a static
method of the Console class defined in
the System namespace.
Comments
Comments are the programmer’s text to explain the code, are ignored by the compiler
and are not included in the final executable code.
// This is my main method of program