Give me an example for this type of method?

Posted by Arjunan_Csharp under C# on 1/18/2013 | Points: 10 | Views : 661 | Status : [Member] | Replies : 1
Hi Friends,

Please show me a simple code with class name as return type in a method?Some of the codings in project as classname as return type for methods?I don't understand What that mean?

Can anyone give me a breif explanation and simple example regarding that one?

For example

public Dataset getEmployees()
in the above code we are using (Dataset)(It's basically a class) but here we are using as return type for getEmployees method.

I want the same as example.Instead of Dataset,user defined class should be as return type.I hope you understand what my doubt is.


Posted by: Kundnani.Rt on: 1/19/2013 [Member] Starter | Points: 25

You can use DataSet in variety of flavors with SQL Data Source, Cracle Data Source, etc.

Following is the general approach to handle DataSet

public DataSet getDS()

// Create two DataTable instances.
DataTable table1 = new DataTable("Users");
table1.Rows.Add("raju", 1);
table1.Rows.Add("ram", 2);

// Create a DataSet and put both tables in it.
DataSet set = new DataSet("office");

return set;

Arjunan_Csharp, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response