Showing posts with label Basic .NET Framework. Show all posts
Showing posts with label Basic .NET Framework. Show all posts

Wednesday, January 21, 2009

What is an Assembly

0 comments
Today we are talking about assembly , Here is some good definition of Assembly so you can understand it well.
Assembly is unit of deployment like EXE or a DLL.
An assembly consists of one or more files (dlls, exe’s, html files etc.), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These
resources, types and references are described in a block of data called a manifest.The manifest is part of the assembly, thus making the assembly self-describing.
An assembly is completely self-describing.An assembly contains metadata information, which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the
assembly itself, it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.
Multiple versions can be deployed side by side in different folders. These different versions can execute at the same time without interfering with each other. Assemblies can be private or shared. For private assembly deployment, the
assembly is copied to the same directory as the client program that references it. No registration is needed, and no fancy installation program is required. When the component is removed, no registry cleanup is needed, and no uninstall
program is required. Just delete it from the hard drive.
In shared assembly deployment, an assembly is installed in the Global Assembly Cache (or GAC). The GAC contains shared assemblies that arglobally accessible to all .NET applications on the machine.

Suggested reading in Basic .NET FrameWork

Thursday, January 15, 2009

What is a Managed Code

1 comments
Managed code runs inside the environment of CLR i.e. .NET runtime. In short all IL are managed
code. But if you are using some third party software example VB6 or VC++ component they are
unmanaged code as .NET runtime (CLR) does not have control over the source code execution
of the language.
Suggested reading in Basic .NET FrameWork

Tuesday, January 13, 2009

What is a CLS(Common Language Specification)

0 comments
CLS(Common Language Specification) is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one steptowards that.
Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.

Suggested reading in Basic .NET FrameWork
For more detail about common type systemt please knock MSDN.

Thursday, January 8, 2009

What is CTS (Common Type System)

0 comments
In order that two language communicate smoothly CLR has CTS (Common Type System).
Example:In VB you have “Integer” and in C++ you have “long” these datatypes are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So “Integer” datatype in VB6 and “int” datatype in C++ will convert it to System.int32 which is datatype of CTS. CLS which is covered in the coming question is subset of CTS.

Understanding Common Type System in .Net Framework
For example, an integer variable in C# is written as int, whereas in Visual Basic it is written as integer. Therefore in .Net Framework you have single class called System.Int32 to interpret these variables. Similarly, for the ArrayList data type .Net Framework has a common type called System.Collections.ArrayList. In .Net Framework, System.Object is the common base type from where all the other types are derived.

This system is called Common Type System. The types in .NET Framework are the base on which .NET applications, components, and controls are built. Common Type System in .Net Framework defines how data types are going to be declared and managed in runtime. The Common Type System performs the following functions:
  • Automatically adapts itself in a framework that enables integration of multiple languages, type safety, and high performance code execution.
  • Provides an object-oriented model.
  • Standardizes the conventions that all the languages must follow.
  • Invokes security checks.
  • Encapsulates data structures.
There are two general types of categories in .Net Framework that Common Type System support. They are value types and reference types. Value types contain data and are user-defined or built-in. they are placed in a stack or in order in a structure. Reference types store a reference of the value’s memory address. They are allocated in a heap structure. You can determine the type of a reference by the values of self-describing types. Reference types can be categorized into self-describing types, pointer types, or interface types.

Note: If you have undergone COM programming period interfacing VB6 application with
VC++ application was a real pain as the datatype of both languages did not have a
common ground where they can come and interface, by having CTS interfacing is smooth.

Suggested reading in Basic .NET FrameWork
For more detail about common type systemt please knock MSDN.

Friday, January 2, 2009

What is Common Language Runtime

1 comments
Before reading about what is CLR it is necessary to know about the IL(Intermediate Language).
Read our previous article about IL(Intermediate Language)

Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework.
All Languages have runtime and its the responsibility of the runtime to take care of the code
execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL,
Java has Java Virtual Machine etc. Similarly .NET has CLR.



Following are the responsibilities of CLR

Garbage Collection :- CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.
Code Access Security :- CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.
Code Verification :- This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such asaccessing invalid memory locations etc.
IL( Intermediate language)-to-native translators and optimizer’s :- CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.

The CLR allows programmers to ignore many details of the specific CPU that will execute the program. It also provides other important services, including the following:
  1. Memory management
  2. Thread management
  3. Exception handling
  4. Garbage collection
  5. Security
For more detail about Common Language Runtime Overview please visit MSDN.

Sunday, December 28, 2008

What is a IL(Intermediate Language)

1 comments
(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL
(Common Intermediate Language). All .NET source code is compiled to IL. This IL is then
converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
Microsoft Intermediate Language (MSIL) is a platform independent language that gets compiled into platform dependent executable file or dynamic link library. It means .NET compiler can generate code written using any supported languages and finally convert it to the required machine code depending on the target machine.
The main advantages of IL are:

1. IL isn't dependent on any language and there is a possibility to create applications with modules that were written using different .NET compatible
languages.
2. Platform independence - IL can be compiled to different platforms or operating systems.

A detail example is available here.
 

Copyright 2009 All Rights Reserved Shakti Singh Dulawat