What is the .NET Framework?
The .NET Framework is a new and revolutionary platform created by Microsoft for developing applications.
- It is a platform for application developers.
- It is a Framework that supports Multiple Language and Cross language integration.
- IT has IDE (Integrated Development Environment).
- Framework is a set of utilities or can say building blocks of your application system.
- .NET Framework provides GUI in a GUI manner.
- .NET is a platform independent but with help of Mono Compilation System (MCS). MCS is a middle level interface.
- .NET Framework provides interoperability between languages i.e. Common Type System (CTS) .
- .NET Framework also includes the .NET Common Language Runtime (CLR), which is responsible for maintaining the execution of all applications developed using the .NET library.
- The .NET Framework consists primarily of a gigantic library of code.
Cross Language integration
You can use a utility of a language in another language (It uses Class Language Integration).
.NET Framework includes no restriction on the type of applications that are possible. The .NET Framework allows the creation of Windows applications, Web applications, Web services, and lot more.
The .NET Framework has been designed so that it can be used from any language, including C#, C++, Visual Basic, JScript, and even older languages such as COBOL.
It is a Framework in which Windows applications may be developed and run.
The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET.
The .NET Framework provides a new programming model and rich set of classes designed to simplify application development for Windows, the Web, and mobile devices. It provides full support for XML Web services, contains robust security features, and delivers new levels of programming power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual C++.
.Net Code Compilation and Execution process
What is "Common Type System" (CTS)?
CTS describes how types are declared used and managed in the runtime and facilitates cross-language integration type safety and high performance code execution. Common type system brings all .Net languages data types on a common platform.
What is "Common Language Runtime" (CLR)?
Common Language Runtime - It is the implementation of CLI. The core runtime engine in the Microsoft .NET Framework for executing applications. The common language runtime supplies managed code with services such as cross-language integration, code access security, object lifetime management, resource management, type safety, pre-emptive threading, metadata services (type reflection), and debugging and profiling support. The ASP.NET Framework and Internet Explorer are examples of hosting CLR.
The CLR is a multi-language execution environment. The CLR is described as the "execution engine" of .NET. It's this CLR that manages the execution of programs. It provides the environment within which the programs run. The software version of .NET is actually the CLR version.
When the .NET program is compiled, the output of the compiler is not an executable file but a file that contains a special type of code called the Microsoft Intermediate Language (MSIL, now called CIL, Common Intermediate Language). This MSIL defines a set of portable instructions that are independent of any specific CPU. It's the job of the CLR to translate this Intermediate code into a executable code when the program is executed making the program to run in any environment for which the CLR is implemented. And that's how the .NET Framework achieves Portability. This MSIL is turned into executable code using a JIT (Just In Time) complier. The process goes like this, when .NET programs are executed, the CLR activates the JIT complier. The JIT complier converts MSIL into native code on a demand basis as each part of the program is needed. Thus the program executes as a native code even though it is compiled into MSIL making the program to run as fast as it would if it is compiled to native code but achieves the portability benefits of MSIL.
It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately.
The CLR is the execution engine for .NET Framework applications. It provides a number of services, including:
· Code management (loading and execution)
· Application memory isolation
· Verification of type safety
· Conversion of IL to native code.
· Access to metadata (enhanced type information)
· Managing memory for managed objects
· Enforcement of code access security
· Exception handling, including cross-language exceptions
· Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged code and data)
· Automation of object layout
· Support for developer services (profiling, debugging, and so on).
What is "Microsoft Intermediate Language" (MSIL)?
A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one need not worry about the syntax of MSIL - since our source code in automatically converted to MSIL. The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language, which is, then run on the host machine. MSIL is similar to Java Byte code.
MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects.
Combined with metadata and the common type system, MSIL allows for true cross- language integration Prior to execution, MSIL is converted to machine code. It is not interpreted.
What is "Common Language Specification" (CLS)?
CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.
What is the basic functionality of Garbage Collector in .Net?
The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities for managed resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.
Here are the list of some tasks performed by the Garbage collector:
- Garbage collector reserves a piece of memory as the application starts for the managed heap.
- Garbage collector controls the managed heap memory currently used and available to an application.
- Garbage collector allocates memory for new objects within the application.
- The Garbage Collector attempts to reclaim the memory of objects that are not referenced.
Which versions of .NET have been released so far with their features:
Version
|
Version Number
|
Release Date
|
Visual Studio
|
Default in Windows
|
1.0
|
1.0.3705.0
|
2002-02-13
|
Visual Studio .NET
|
|
1.1
|
1.1.4322.573
|
2003-04-24
|
Visual Studio .NET 2003
|
Windows Server 2003
|
2.0
|
2.0.50727.42
|
2005-11-07
|
Visual Studio 2005
|
Windows Server 2003 R2
|
3.0
|
3.0.4506.30
|
2006-11-06
|
|
Windows Vista, Windows Server 2008
|
3.5
|
3.5.21022.8
|
2007-11-19
|
Visual Studio 2008
|
Windows 7, Windows Server 2008 R2
|
4.0
|
4.0.30319.1
|
2010-04-12
|
Visual Studio 2010
|
|
.Net Framework 1.0
This is the first release of the .NET Framework, released on 13 February 2002 and available for Windows 98, Me, NT 4.0, 2000, and XP. Mainstream support by Microsoft for this version ended 10 July 2007, and extended support ended 14 July 2009.
.Net Framework 1.1
This is the first major .Net Framework upgrade. It is available on its own as a redistributable package or in a software development kit, and was published on 3rd April 2003. It is also part of the second release of Microsoft Visual Studio .Net (released as Visual Studio .Net 2003)
Changes in 1.1 in comparison with 1.0
- Built-in support for mobile ASP.NET controls. Previously available as an add-on for .NET Framework, now part of the framework.
- Security changes – enable Windows Forms assemblies to execute in a semi-trusted manner from the Internet, and enable Code Access Security in ASP.NET applications.
- Built-in support for ODBC and Oracle databases. Previously available as an add-on for .NET Framework 1.0, now part of the framework.
- .NET Compact Framework – a version of the .NET Framework for small devices.
- Internet Protocol version 6 (IPv6) support.
- Numerous API changes.
.NET Framework 2.0
Released with Visual Studio 2005, Microsoft SQL Server 2005, and BizTalk 2006.
The 2.0 Redistributable Package can be downloaded for free from Microsoft, and was published on 22 January 2006.
Changes in 2.0 in comparison with 1.1
- Generics
- Language support for generics built directly into the .NET CLR.
- Full 64-bit support for both the x64 and the IA64 hardware platforms.
- Numerous API changes.
- SQL Server integration – .NET 2.0, VS 2005, and SQL Server 2005 are all tied together. This means that instead of using T-SQL, one can build stored procedures and triggers in any of the .NET-compatible languages.
- A new hosting API for native applications wishing to host an instance of the .NET runtime. The new API gives a fine grain control on the behavior of the runtime with regards to multi threading, memory allocation, assembly loading and more (detailed reference). It was initially developed to efficiently host the runtime in Microsoft SQL Server, which implements its own scheduler and memory manager.
- Many additional and improved ASP.NET web controls.
- New data controls with declarative data binding.
- New personalization features for ASP.NET, such as support for themes, skins, master pages and web parts.
- .NET Micro Framework – a version of the .NET Framework related to the Smart Personal Objects Technology initiative.
- Membership provider
- Partial classes
- Nullable types
- Anonymous methods
- Iterators
- Data tables
.NET Framework 3.0
.NET Framework 3.0, formerly called WinFX, was released on 21 November 2006. It includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems. It is also available for Windows XP SP2 and Windows Server 2003 as a download. There are no major architectural changes included with this release; .NET Framework 3.0 uses the Common Language Runtime of .NET Framework 2.0. Unlike the previous major .NET releases there was no .NET Compact Framework release made as a counterpart of this version. Version 3.0 of the .NET Framework shipped with Windows Vista. It also shipped with Windows Server 2008 as an optional component (disabled by default).
.NET Framework 3.0 consists of four major new components:
- Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies. See WPF SDK for developer articles and documentation on WPF.
- Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.
- Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
- Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.
NET Framework 3.5
Version 3.5 of the .NET Framework was released on 19 November 2007, but it is not included with Windows Server 2008. As with .NET Framework 3.0, version 3.5 uses the CLR of version 2.0. In addition, it installs .NET Framework 2.0 SP1, (installs .NET Framework 2.0 SP2 with 3.5 SP1) and .NET Framework 3.0 SP1 (installs .NET Framework 3.0 SP2 with 3.5 SP1), which adds some methods and properties to the BCL classes in version 2.0 which are required for version 3.5 features such as Language Integrated Query (LINQ).
Changes since version 3.0
- New language features in C# 3.0 and VB.NET 9.0 compiler
- Adds support for expression trees and lambda methods
- Extension methods
- Expression trees to represent high-level source code at runtime.
- Anonymous types with static type inference
- Language Integrated Query (LINQ) along with its various providers
- LINQ to Objects
- LINQ to XML
- LINQ to SQL
- Paging support for ADO.NET
- ADO.NET synchronization API to synchronize local caches and server side data stores
- Asynchronous network I/O API.
- Peer-to-peer networking stack, including a managed PNRP resolver
- Managed wrappers for Windows Management Instrumentation and Active Directory API’s
- Enhanced WCF and WF runtimes, which let WCF work with POX and JSON data, and also expose WF workflows as WCF services. WCF services can be made stateful using the WF persistence model. Support for HTTP pipelining and syndication feeds.
- ASP.NET AJAX is included.
.NET Framework 4
On 12 April 2010, the final version of .NET Framework 4.0 was launched alongside the final release of Visual Studio 2010.
Key focuses for this release are:
- Parallel Extensions to improve support for parallel computing, which target multi-core or distributed systems. To this end, they included technologies like PLINQ (Parallel LINQ), a parallel implementation of the LINQ engine, and Task Parallel Library, which exposes parallel constructs via method calls.
- New Visual Basic .NET and C# language features, such as statement lambdas, implicit line continuations, dynamic dispatch, named parameters, and optional parameters.
- Support for Code Contracts.
- Inclusion of new types to work with arbitrary-precision arithmetic (System.Numerics.BigInteger) and complex numbers (System.Numerics.Complex).
What is encapsulation?
Encapsulation is the OOPs concept of binding the attributes and behaviors in a class, hiding the implementation of the class and exposing the functionality.
What is Overloading?
When we add a new method with the same name in a same/derived class but with different number/types of parameters, the concept is called overload and this ultimately implements Polymorphism.
What is overriding?
When we need to provide different implementation in a child class than the one provided by base class, we define the same method with same signatures in the child class and this is called overriding.
What is managed data?
The data for which the memory management is taken care by .Net runtime’s garbage collector, and this includes tasks for allocation de-allocation.
What is Multi-tasking?
It is a feature of operating systems through which multiple programs may run on the operating system at the same time, just like a scenario where a Notepad, a Calculator and the Control Panel are open at the same time.
What is Multi-threading?
When an application performs different tasks at the same time, the application is said to exhibit multithreading as several threads of a process are running.