Modern object-oriented programming language developed by Microsoft.
It is simple, powerful & versatile making it great for building a wide range of applications, from desktop software to web service & games.
ASP.NET is a web framework also developed by Microsoft. It supports several programming languages C#,VB.NET & F#. It is for creating server side code.
- .NET Runtime - Core component. It includes CLR(Common Language Runtime), which manages memory, handles exceptions and provides other system services.
The CLR is like the engine of a car. Just as an engine runs the car, the CLR runs .NET applications.
- .NET Libraries - A vast collection of pre-built code that developers can use to perform common tasks, such as file handling, data access, and network co…
Modern object-oriented programming language developed by Microsoft.
It is simple, powerful & versatile making it great for building a wide range of applications, from desktop software to web service & games.
ASP.NET is a web framework also developed by Microsoft. It supports several programming languages C#,VB.NET & F#. It is for creating server side code.
- .NET Runtime - Core component. It includes CLR(Common Language Runtime), which manages memory, handles exceptions and provides other system services.
The CLR is like the engine of a car. Just as an engine runs the car, the CLR runs .NET applications.
- .NET Libraries - A vast collection of pre-built code that developers can use to perform common tasks, such as file handling, data access, and network communication.
The Class Library is like a toolbox filled with tools.
using System;
class Program
{
static void Main()
{
// Using the Class Library to print a message to the console
Console.WriteLine("Hello, World!");
// Using the Class Library to get the current date and time
DateTime now = DateTime.Now;
Console.WriteLine("Current Date and Time: " + now);
}
}
-
C# is a programming language that is both object-oriented and component oriented.
-
It is based on C++ and Java, but it has many additional extensions used to perform component oriented programming approach.
Hello C# World
using System; namespace HelloWorldApplication { class HelloWorld { static void Main(string[] args) { /* my first program in C# */ - comments Console.WriteLine("Hello World"); Console.ReadKey(); } } }
- using System : the using keyword is used to include the System namespace in the program. A program generally has multiple using statements. It is like import statement.
using System; is like saying, “I want to use the tools from the ‘System’ section of the library.” Imagine you’re in a large library with thousands of books. Each section of the library is like a namespace, and each book is like a class or a function within that namespace. Now, if you want to read a book from the “Science” section, you don’t want to walk to the “Science” section every time you need a book. Instead, you can bring the books you need to your table.
- namespace : A namespace is groups of related classes together.
Think of a namespace as a specific section in a library. This section contains a collection of books on a particular topic. “Science Fiction” section in a library is like a namespace.
- Class : A class is a blueprint or template in programming that defines the structure and behavior (data and methods) of objects.
Think of a class as a book in a library. This book contains chapters, which are like methods. Each chapter provides specific information or instructions (behavior). While most books have multiple chapters, our HelloWorld class is a simple book with just one chapter called Main, which contains all the information and instructions for one task.
- Main : The Main method is like the front door of a house. When you open it, you enter and see everything inside. Similarly, when a C# program runs, it starts with the Main method, which tells the program what to do first.
- Class: A blueprint that defines the structure and behavior of objects.
- Namespace: A grouping of related classes.
- Assembly: A compiled code package that contains multiple namespaces all bundled together into a single file (like a DLL or EXE).
- Application: A complete program made up of multiple assemblies.
Key Benefits
Supports for numerous programming languages - C#,F# (primary languages for ASP.NET core)
A common runtime engine shared by all .NET languages
A comprehensive base class library - .NET gives you a huge collection of ready-made tools (called classes and types) that help you build all kinds of apps.
Simplified Deployment Model - .NET apps are easy to install and run — no need to mess with system settings or the Windows registry. .NET apps don’t rely on the registry. Instead, they: Run from their own folder. Can be copied and moved easily, Don’t interfere with other apps or system settings, Allow multiple versions of .NET and apps to coexist peacefully.
🔄 You can have: One app using .NET 6. Another using .NET 8 → Both work fine on the same machine without registry conflicts.