0% found this document useful (0 votes)
5 views

Visual Programming L1

C# is a modern, object-oriented programming language developed by Microsoft, suitable for various applications including web, desktop, mobile, and game development. It runs on the .NET Framework or .NET Core, utilizing a compiler to convert code into machine-readable format and features automatic memory management through garbage collection. The Visual Studio .NET IDE provides tools for building applications with C#, including debugging, testing, and database integration.

Uploaded by

Abeer Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Visual Programming L1

C# is a modern, object-oriented programming language developed by Microsoft, suitable for various applications including web, desktop, mobile, and game development. It runs on the .NET Framework or .NET Core, utilizing a compiler to convert code into machine-readable format and features automatic memory management through garbage collection. The Visual Studio .NET IDE provides tools for building applications with C#, including debugging, testing, and database integration.

Uploaded by

Abeer Fatima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Visual Programming

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.

Powerful & Fast – Supports modern features like async


programming.
• C# runs on the .NET Framework (older)
or .NET Core (modern and works on Windows,
Mac, Linux). It uses a compiler to convert code
How C# into machine-readable format.

Works? C# Code → Compiler →


Executable Program
Note: Like Java, C# doesn’t allow multiple
inheritance (a class can’t have more than one
parent class), and it doesn’t use pointers in
normal code. But it cleans up memory
automatically using a process called garbage
collection.
The Common Language Runtime (CLR)
MSIL (Microsoft Intermediate Language)
Code
Just In Time Compilers (JITers)

The Class
The Framework .NetLibrary (FCL)
Architectur
The Common Language Specification (CLS)
e and .Net
Framework
The Common Type System (CTS)

Garbage Collection (GC)

The .Net Framework


NET (pronounced "dot net") is a
software development platform
created by Microsoft. It provides
tools and libraries to build
applications for:

Web (ASP.NETWhat
MVC, Blazor)
Desktop is .NET?Forms, WPF)
(Windows
Mobile (Xamarin)
Cloud (Azure, AWS)
Game Development (Unity)
.NET Architecture

Common Language Runtime (CLR)

1. .Net Common Language Runtime


(CLR), also called .Net Runtime.
2. This is the brain of .NET. It runs
your program and does important
jobs like:
3. Turning your code into machine
code (using JIT compiler)
4. Managing memory
5. Handling errors
6. Running the program step by step
7. You don’t talk to the computer
directly — CLR handles that for
you.
When you write a C# program, it doesn't
turn directly into computer language.
MSIL (Microsoft
First, it turns into MSIL, which is like a
Intermediate “universal” language. Later, CLR
Language) Code changes this MSIL into actual machine
code that your computer understands.
This tool works when you run
your program.
Just In It takes MSIL and just in time,
Time turns it into real .exe or .dll
files that your computer can
Compiler execute.
s (JITers)
.NET gives you lots of built-in tools and classes (FCL) to
help with

The Think of this as a toolbox full of ready-made tools.


It gives you built-in code for:
Framewor
k Class Working with files

Library Strings and numbers

(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

(GC) longer needs it, the Garbage Collector


will clean it up automatically so your
program runs smoothly.
The .Net
Framewo
rk
The Visual
Studio.Net IDE

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

/* These lines of text will be ignored by the compiler */

You might also like