What is the .NET framework?

NET (pronounced “dot net”) is a framework created by Microsoft that developers can use to build a variety of applications, including Windows desktop programs, web applications, and mobile apps.

It provides a large library of pre-built code, called the Framework Class Library (FCL), that developers can use to quickly and easily add functionality to their applications.

Additionally, it includes a runtime environment, the Common Language Runtime (CLR), which provides features such as memory management and security.

C# and Visual Basic are the most common languages used to write code in the .NET framework, but it also supports other languages such as F# and C++/CLI

What are some examples of .NET codes?

Here are a few examples of C# code, which is a language commonly used with the .NET framework:

  1. Hello World:

using System;

class Program

{

    static void Main(string[] args)

    {

        Console.WriteLine(“Hello, World!”);

    }

}

2. Simple Calculator:

using System;

class Calculator

{

    static void Main(string[] args)

    {

        Console.WriteLine(“Enter the first number:”);

        double num1 = Convert.ToDouble(Console.ReadLine());

        Console.WriteLine(“Enter the second number:”);

        double num2 = Convert.ToDouble(Console.ReadLine());

        Console.WriteLine(“Enter the operator (+, -, *, /):”);

        string op = Console.ReadLine();

        double result;

        switch (op)

        {

            case “+”:

                result = num1 + num2;

                break;

            case “-“:

                result = num1 – num2;

                break;

            case “*”:

                result = num1 * num2;

                break;

            case “/”:

                result = num1 / num2;

                break;

            default:

                Console.WriteLine(“Invalid operator!”);

                return;

        }

        Console.WriteLine(“Result: ” + result);

    }

}