Professional Documents
Culture Documents
============
1. High Level Languages : These languages are easy to learn And Easy To
Understand.
2. Low Level Languages : These languages are required for developing (Assembly
Language) device driver programming.
Note:
ex: The exe file copied from windows os to linux os will not allow program
execution since native code is differed. Hence it is called platform dependent.
Categories Of Programmers
=========================
1. System Programmers : One who writes programs for a given hardware eg. device
drivers
2. Application Programmers : One who programs application used by people for their
requirement.
Note: .Net is Used for application programming but not for System programming.
Important Terms
===============
Architecture
============
Note:
Framework:
==========
It is ready to use collection of classes and interfaces used for developing a
particular type of application.
It Is A Product Of Microsoft Introduced In The Year 2002 As .Net 1.0 And Was
Developed by Anders Hejlsberg.
Versions of .NET
================
.NET provides many built-in components for development whereas in Java, we have to
mostly use third party components.
Note:
=====
. To execute .Net Applications we require .Net Framework as Platform Whereas To
Execute Java Applications We Require JRE as Platform.
.Net framework is not available on many OS, but JRE is available on many OS.
In other OS, .net framework is available but there is no 100% implementation. Hence
there is no guarantee that .net application developed on windows OS will provide
same execution and output on other os. For this reason We cannot say .net is
platform independent.
Features of C#.Net
==================
1. Platform Independent.
As .DLL (Dynamic Link Library) and .exe files are executable on any OS with
the help of CLR. Hence .net is called as Platform independent.
.DLL and .EXE contains the code in the form of Byte Code (also called as MSIL
Code - Microsoft Intermediate Language).
CLR is a software, Which Contains A Compiler That converts byte code To
machine language(Native Code) And After Translation To Native Code, CLR Executes
That Code.
Every language will have its own compiler and when the code is compiled it
provides a common type of output irrespective of OS i.e. MSIL along with meta data.
When soure code gets compiled does not give machine code directly rather
gives intermediate code i.e. MSIL code.
Compiled output of any language in .net is MSIL.
MSIL code in binary format is available in the form of .exe and .dll file
which is referred as PE file (portable, Executable)
JIT compiler(Just In Time) one of the components of CLR is responsible for
compiling the MSIL code to Native Code And That Code gets executed on OS.
2. Pre JIT - This Compiler Will Compile Complete MSIL Code To Native Code.
3. Econo JIT - This Compiler Will Compile Required MSIL Code At Execution To Native
Code But The Code Will Not Be Buffered/Cached For Reuse.
MSIL Code (Byte Code):
======================
PE : (Portable Executable)
==========================
i. It is a microsoft win32 compatible format file for .net applications,
which contains MSIL code and meta data in binary form.
ii. It has the extension .exe or .dll
iii. PE is based on all win32 platform compatible COFF specification i.e.
given by Microsoft (Common Object File Format)
2. Language Independent.
3. Language Interoperability.
Ex: Data Types Used In C#.Net Differs With The Data Types Used In VB.Net. Hence
When Applications Of These Languages Need To Be Executed Together Then The problem
is solved in .Net Thru CTS.
CTS contains list of data types that are common for both languages Thru which CLR
understands.
VB.NET C#.NET
| |
Integer int
| |
System.Int32 System.Int32
|___________ _________|
CTS
(CLR)
This will allow C# to invoke VB code and vice versa. Hence Language
Interoperability Has Become Possible In .Net.
Advantages
==========
1. Vastly simplified development
2. Integration of code Written In Various Languages.
3. Code Reuse Thru Implementation Inheritance.
4. Automatic object life time management.
1. CLR manages memory for managed code (Code that targets CLR is referred to
managed code)
2. All Memory allocations of objects and buffers are made from a managed heap.
3. Unused objects and buffers are cleaned up automatically by Garbage collector.
BCL/FCL -
BCL - Deals With Basic Rules Of C#.NET like string, DateTime, Mathematical
Functions,.....etc.
FCL - Deals With Advanced Rules Of C#.NET
Architecture Of BCL/FCL
=======================
Advantages of BCL/FCL
=====================
1. Language independent
2. Completely object oriented
3. Packaged with .net framework in the form of DLL files.
BCL/FCL includes;
=================
Data types, Conversions (Casting, Conversion Methods using "Convert" class,
Parsing, Boxing & unboxing), Formatting
Collections : ArrayList,Hashtable,Stack,Queue,..etc.
Globalization : Cultures, sorting,......etc.
IO streams : Binary and Text streams, Files, Serialization &
DeSerialization
Networking : Http, TCP/IP, Sockets,..etc.
Reflection : Metadata and IL
Completely Into
Ngen -------------> PE ----------------> GAC
Translates a Special File
Namespace
=========
A namespace is a logical collection of classes and other types with unique
names.
The structure of the namespace is like a tree where all the related classes
are like leafs.
All BCL begin with the namespace System.
Example:
System.windows.Forms.Button
System.web.UI.Webcontrols.Button
System
Collections Security
Configuration Diagnostics Text
Globalization Threading
IO Runtime
Net Reflection
Data Windows
OracleClient
SqlClient
OleDb
Output Statement
================
DATA TYPES
==========
Based on the data type the size of variable and the format in memory is decided.
Based on the data type the compiler is going to validate expressions making the
language type safe.
Integral Types
--------------
=============================================Data Type Size .net (CTS)
Comments
=============================================byte 1 System.Byte
0-255 (It is unsigned)
sbyte 1 System.SByte -128 to 127 Signed
short 2 System.Int16
ushort 2 System.UInt16
int 4 System.Int32
uint 4 System.UInt32
long 8 System.Int64
ulong 8 System.UInt64
=============================================
Float Types
-----------
Note: All the above data types are value types except string and object are
===== of reference types.
1. Global Memory -- Used by all global variables. These variables are allocated
when the application begins and will remain in memory through out the life of
application.
1) The value type of variable has value whereas the value of a reference type is
reference to value (object) on heap.