grs,
Why not do both and let the caller decide? This way, you can have a
dataset that is populated correctly, or you can just create a new one and
return that. As a matter of fact, your code will just look like this:
public DataSet CreateDataSet()
{
// Create the return value.
DataSet ds = new DataSet();
// Populate.
CreateDataSet(ds);
// Return.
return ds;
}
public void CreateDataSet(DataSet dataSet)
{
// Initialize here.
}
The only thing I would do is change the overload of CreateDataSet that
takes the data set parameter so that the name is InitializeDataSet, since
you arent really creating one.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"grs" <gs****@budgetext.com> wrote in message
news:O9**************@TK2MSFTNGP15.phx.gbl...
What is the recommended method of moving datsets around in code.
Do you use 1 or 2 below or does it make a difference.
1. public void CreateDataSet(DataSet aDataset)
or
2. public DataSet CreateDataSet()
return dataset
thanks