Thursday, April 30, 2009

What is Boxing and Unboxing in .net?

Boxing:
It is a process of converting value type into Reference Type.

UnBoxing:
It is a reverse process of Boxing i.e. Converting Reference Type
into Value Type.

Here is the Example :

class Test
{
static void Main() {
int i = 123;
object o = i; //boxing
int j = (int) o; //unboxing
}
}

Wednesday, April 29, 2009

Diffrence between Data Reader, Dataset and Data Adapter

Difference  Angle

Data Reader

Dataset

Data Adapter

Disconnected mode

Connected mode

Disconnected mode

Disconnected mode

Forward Only

Yes

No

No

Read/Write

Read Only

Read/Write

Read/Write

Handling

Database Table

Can handle text file, XML file and Database table

Can handle text file, XML file and Database table

Storage Capacity

No storage

Temporary Storage Capacity

Temporary Storage Capacity

Accessibility

Can access one table at a time

Multiple table at a time

Multiple table at a time

Faster

Much faster than dataset

Less faster than data reader

Less faster than data reader

Useful Functions in ASP.net

1. Split Function in C#

Sample code:
string test = "afdas.;asdas.;asd";
string[] test1 = test.Split(';'); //For Character
string[] test2 = test.Split(new string[] { ".;" }, StringSplitOptions.None); //For String

Tuesday, April 28, 2009

Difference between ASP and ASP.net

Image Version (Click on image for enlarge version)





Text Version (See Below)

Difference Angle

ASP.Net

ASP

Generation

ASP.NET is the next generation of ASP to develop web Applications.(Latest)

After the introduction of ASP.NET, old ASP is called 'Classic ASP'.(old)

Language Support

ASP.NET supports more languages including C#, VB.NET, J# etc.

Classic ASP uses VB Script/JavaScript  for server side coding

Robustness and Reliability

ASP.net able to write much more robust and reliable programs

Not much robust and reliable

Server/HTML controls

ASP.NET offers a very rich set of controls called Server Controls and Html Controls. It is very easy to drag and drop any controls to a web form

In classic ASP, there was no server controls. You have to write all html tags manually

Code Execution

ASP.NET is compiled to efficient Microsoft Intermediate Language (MSIL) by CLR

ASP is interpreted

Database Interaction

ASP.NET uses the ADO.NET technology (which is the next generation of ADO).

Classic ASP uses a technology called ADO(ActiveX Data Objects) to connect and work with databases

File Extension

.ASPX

.ASP

OOPs

It is Object Oriented Programming, uses the event-driven model.

It is not truly Object Oriented; it uses more of a top-down programming style, where code execution begins at the top and executes down to the end

Framework Support

ASP.net Framework provides a very clean separation of code from content

ASP has Mixed HTML and coding logic

XML Support

Full XML Support for easy data exchange

No in-built support for XML.