Creating and using objects in C#

May 28 2008 7:00 AM
Hi everyone,

There are two ways by which we can use objects in C#.
1) DataSet ds = new DataSet();
2) DataSet ds;

Can anyone tell me what is the difference between these two. I know logically, in the first one memory is allocated for that object and constructors are called. But we are used to with both the ways of creating the objects. Which is the correct way to create object and what are the situations on which either of the two should be used. Its very helpful if example is given with explanation.

Thanks
Pankaj

Answers (2)