Mikä on .NET Framework? Selittää Architecture & komponentit

⚡ Älykäs yhteenveto

.NET Framework is a Microsoft platform for building and running Windows desktop, web, and service applications. It bundles the Common Language Runtime, a shared class library, and languages such as C# and VB.NET into one managed development environment.

  • 🧩 Määritelmä: .NET Framework is a Windows-only stack of tools, languages, and libraries for desktop and web apps.
  • 🏛️ Archirakenne: The Common Language Runtime executes managed code while class libraries supply reusable, ready-made functionality.
  • ⚙️ Pääkomponentit: The CLR, the class library, and supported languages work together to compile and run applications.
  • 🛡️ Suunnitteluperiaatteet: Interoperability, portability, security, automatic memory management, and simplified deployment shape the framework.
  • 🌐 Sovellustyypit: WinForms builds desktop apps, ASP.Net powers websites, and ADO.Net connects to databases.
  • 🤖 Tekoälyn merkitys: ML.NET and the ONNX Runtime add machine learning, while GitHub Copilot accelerates .NET coding.

What is .NET Framework

Mikä on .Net Framework?

. Net Framework on ohjelmistokehitysalusta, jonka on kehittänyt Microsoft rakentamiseen ja juoksemiseen Windows sovellukset. .Net-kehys koostuu kehittäjätyökaluista, ohjelmointikielistä ja kirjastoista työpöytä- ja verkkosovellusten rakentamiseen. Sitä käytetään myös verkkosivustojen, verkkopalvelujen ja pelien rakentamiseen.

The .Net framework was meant to create applications that would run on the Windows Alusta. Ensimmäinen versio .Net frameworkista julkaistiin vuonna 2002. Version nimi oli .Net framework 1.0. The Microsoft .Net framework has come a long way since then, and the latest version is .Net Framework 4.8.1.

Microsoft .Net framework can be used to create both — Lomakepohjainen ja Web-pohjainen sovelluksissa. Web-palvelut voidaan myös kehittää käyttämällä .Net-kehystä.

Kehys tukee myös erilaisia ​​ohjelmointikieliä, kuten Visual Basic ja C#. Joten kehittäjät voivat valita ja valita kielen kehittääkseen vaaditun sovelluksen. Tässä luvussa opit joitakin .Net-kehyksen perusteita.

. Net Framework Archirakenne

. Net Framework Archirakenne on ohjelmointimalli .Net-alustalle, joka tarjoaa suoritusympäristön ja integroinnin eri ohjelmointikieliin erilaisten ohjelmointikielien yksinkertaista kehittämistä ja käyttöönottoa varten. Windows ja työpöytäsovelluksia. Se koostuu luokkakirjastoista ja uudelleenkäytettävistä komponenteista.

The basic architecture of the .Net framework is shown below.

. Net Framework Architecture Kaavio

. Net Framework Architecture Kaavio

.NET-komponentit

.Net-kehyksen arkkitehtuuri perustuu seuraaviin keskeisiin komponentteihin:

1. Common Language Runtime

Common Language Runtime (CLR) is the execution engine in .Net architecture on which the .Net programs are run.

The CLR has the following key features:

poikkeus Käsittely — Exceptions are errors that occur when the application is executed. Examples of exceptions are:

  • Jos sovellus yrittää avata tiedoston paikallisella koneella, mutta tiedostoa ei ole.
  • Jos sovellus yrittää hakea tietueita osoitteesta a tietokanta, mutta yhteys tietokantaan ei ole kelvollinen.

Roskakokoelma — Garbage collection is the process of removing unwanted resources when they are no longer required. Examples of garbage collection are:

  • A file handle that is no longer required. If the application has finished all operations on a file, then the file handle may no longer be required.
  • Tietokantayhteyttä ei enää tarvita. Jos sovellus on suorittanut kaikki tietokannan toiminnot, tietokantayhteyttä ei ehkä enää tarvita.

Working with various programming languages — As noted in an earlier section, a developer can develop an application in a variety of .Net programming languages.

  1. Kieli — The first level is the programming language itself; the most common ones are VB.Net and C#.
  2. kääntäjä — There is a compiler that is separate for each programming language. So underlying the VB.Net language, there will be a separate VB.Net compiler. Similarly, for C#, you will have another compiler.
  3. Yhteinen kielen kesto — This is the final layer in .Net, used to run a .Net program developed in any ohjelmointikieli. The subsequent compiler sends the program to the CLR layer to run the .Net application.

.NET-komponentit

2. Luokan kirjasto

.NET Framework sisältää joukon vakioluokkakirjastoja. Luokkakirjasto on kokoelma menetelmiä ja toimintoja, joita voidaan käyttää ydintarkoitukseen.

For example, there is a class library with methods to handle all file-level operations. So there is a method that can be used to read the text from a file. Similarly, there is a method to write text to a file.

Useimmat menetelmät on jaettu joko järjestelmään* tai Microsoft.* nimiavaruudet. (Tähti * tarkoittaa vain viittausta kaikkiin menetelmiin, jotka kuuluvat järjestelmän tai Microsoft namespace.)

A namespace is a logical separation of methods that groups related classes under one name.

3. Kieli (kielet

The types of applications that can be built in the .Net framework are classified broadly into the following categories.

WinForms — This is used for developing Forms-based applications, which would run on an end-user machine. Notepad is an example of a client-based application.

ASP.Net — This is used for developing web-based applications, which are made to run on any browser such as Internet Explorer, Chrome, or Firefox.

  • The web application would be processed on a server, which would have Internet Information Services installed.
  • Internet Information Services, or IIS, is a Microsoft component that is used to execute an Asp.Net sovellus.
  • Suorituksen tulos lähetetään sitten asiakaskoneille, ja tulos näytetään selaimessa.

ADO.Net — This technology is used to develop applications to interact with databases such as Oracle or Microsoft SQL Palvelimelle.

Microsoft varmistaa aina, että .Net-kehykset ovat kaikkien tuettujen vaatimusten mukaisia Windows käyttöjärjestelmät.

.Net Framework -suunnitteluperiaate

The following design principles are what make the .Net framework very relevant for creating .Net-based applications.

1) Yhteentoimivuus — The .Net framework provides a lot of backward support. Suppose you had an application built on an .Net-kehyksen vanhempi versio, say 2.0. Running the same application on a machine with a higher version, say 3.5, would still work. This is because with every release, Microsoft varmistaa, että vanhemmat kehysversiot sopivat hyvin uusimpaan versioon.

2) siirrettävyys — Applications built on the .Net framework can be made to work on any Windows alusta. Ja nyt viime aikoina, Microsoft is also envisioning making Microsoft tuotteet toimivat muilla alustoilla, kuten iOS ja Linux.

3) Turvallisuus — The .NET Framework has a good security mechanism. The inbuilt security mechanism helps in both validation and verification of applications. Every application can explicitly define its security mechanism. Each security mechanism is used to grant the user access to the code or to the running program.

4) Muistinhallinta — The Common Language Runtime (CLR) does all the work of Muistinhallinta. The .Net framework has all the capability to see those resources that are not used by a running program. It would then release those resources accordingly. This is done via a program called the “Garbage Collector” that runs as part of the .Net framework. The garbage collector runs at regular intervals and keeps checking which system resources are not utilized, and frees them accordingly.

5) Yksinkertaistettu käyttöönotto — The .Net framework also has tools to package applications built on it. These packages can then be distributed to client machines, where they automatically install the application.

UKK

The .NET Framework runs only on Windows and is now in maintenance mode at version 4.8.1. Modern .NET, formerly .NET Core, is cross-platform, open source, and actively developed, making it the recommended choice for new projects.

The Common Language Runtime (CLR) is the engine that executes managed code, handling memory and exceptions. The Common Language Specification (CLS) is a set of rules every .NET language follows so components written in different languages interoperate safely.

The .NET Framework supports several languages that compile to a common intermediate language. The most widely used are C# and VB.NET, with F# for functional programming. All of them share the same runtime, class library, and tooling.

No. The .NET Framework is Windows-only. To target Linux or macOS you use modern .NET, formerly .NET Core, which is cross-platform. The older Mono project also ran some .NET Framework code on other operating systems.

Yes. The .NET Framework is free to download and use, and it ships built into Windows. Development tools such as Visual Studio Community and Visual Studio Code are also free for individuals, small teams, and open-source projects.

Yes. Version 4.8.1 remains supported as a Windows component and receives security and reliability fixes. However, Microsoft focuses new features on modern .NET, so most new development now targets that platform instead of the Framework.

Yes. ML.NET lets you train and run machine learning models directly in C#, and the ONNX Runtime executes pre-trained deep learning models. You can also call cloud AI services, so .NET applications add intelligent features without leaving the ecosystem.

Yes. GitHub Copilot suggests C# and VB.NET code inside Visual Studio and VS Code, scaffolding classes, methods, and boilerplate from comments. Treat its output as a first draft and review it, since generated code can miss edge cases or project conventions.

Tiivistä tämä viesti seuraavasti: