Click to See Complete Forum and Search --> : Remoting question


jhammer
July 18th, 2005, 04:39 AM
The server object has a public method:

public DataSet GetDataSet()
{
return ds.Copy();
}


When the client needs the server copy of the data, it calls GetDataSet.

My question: Is the Copy needed? The method DataSet.Copy is expensive. I need the client to have a copy of the dataset, but my instincts tell me that the client will get a copy of the dataset anyhow (and not a reference to it).

Am I right?

torrud
July 18th, 2005, 05:12 AM
Yes, you are right. You can do the follwing on the server side.
public DataSet GetDataSet()
{
return ds;
}

Have a look at the Data Transfer Object (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/desdto.asp) design pattern. It should gives you all informations you need.