Wednesday, October 28, 2009

What .net means?

Microsoft .net framework is a piece of software that you can install on Microsoft OS,
.net framework consist of 2 main parts:
1-Common Language Run-time (CLR)
2-Base Class Library (BCL)
3-Commot Type System (CTS)

1-CLR:
when you develop an application using C# or any other .net languages VB.net, C++.net F#, J#.. the Visual Studio as a compiler compile your source code (C#) for example into Intermediate Language (IL)
, not into EXE file, and this to provide portability and platform independence in other hand you can write your application using C# and Visual Studio will compile it into (IL) that you can copy and paste it into other machine that has .Net installed on it.
then once you double click the EXE file to open it, the CLR is the major component in .net which responsible for compiling your source code from IL into EXE using a technique called (JIT) or just in time compiling.
also CLR ...
  1. Manages your application on run time and cleaning up your memory (GC)
  2. Manage threads
  3. Enforce security mechanism
  4. Handle run-time exceptions.

2-BCL:
it a huge set of classes and name spaces pre-written for you to so you can use them to
  1. Connect data bases (System.Data /System.Data.SqlClient)
  2. Read and write files (System.IO)
  3. use data structure algorithms (System.Collections/System.Collections.Generic)
  4. Read and write XML data (System.Xml)
  5. or even encrypt and decrypt data using (System.Security.Cryptography) ,ect.
by the time using .net you will get more knowledge of using .net classes... Most of the classes are locate under System namespace.

3-CTS:
CTS is a part of .Net framework that responsible for converting C#, VB types into generic .net types: 4example
int(C#) /integer(VB) -> converted into System.Int32
bool(C#)/boolean(VB) -> System.Boolean
so that CLR (in my opinion) is one engine for any .net languages.

Windows Vista, Server 2008 comes with .net FW 3.0, Windows 7 comes with FW 3.5

one last important thing to notice(Assembly)
Assemblies, are the deployment unit, the out put of your source code, in other meaning it's you application,
assemblies can be (DLL/EXE)
EXE-> Executable file that can be (Console/Windows app)
DLL-> Library to be used,
Assemblies content may vary but every Assembly contains main 3 parts:
  1. IL (Intermediate Language)
  2. Resources (could be variables, Images, MP3...etc) that you call and use in your application
  3. Meta Data\Manifest: info describes the Assembly (AssemblyCopyright,AssemblyTitle,AssemblyVersion,AssemblyTitle)
Private Assembly : is an Assembly used within one application , located in my application sub directory.
Shared Assembly/Strong named Assembly : is an Assembly that shared and can be used within multiple applications on the same machine, Located in the GAC (Global Assembly Cash) this kinda off Assembly must have a Strong Name, using (sn -k c:\myKey.snk) command line to generate a strong name for your assembly and (gacutil -i) to locate your Assembly in the GAC.

for more reading about .Net versions and .net history, see
http://en.wikipedia.org/wiki/.NET_Framework