Hello :O)
Im in the process of learning asp.net, and i'm reading a nice book. But then
suddenly i came across this:
public ICollection DataLoad()
{
DataTable dtEmployee = new DataTable();
DataRow drEmployee;
dtEmployee.Columns.Add(new DataColumn("emp_id",
System.Type.GetType("System.Int16")));
dtEmployee.Columns.Add(new DataColumn("emp_name",
System.Type.GetType("System.String")));
drEmployee = dtEmployee.NewRow();
drEmployee["emp_id"] = 1;
drEmployee["emp_name"] = "E.E. Smith";
dtEmployee.Rows.Add(drEmployee);
dvEmployee = new DataView(dtEmployee);
return dvEmployee;
}
The method type is ICollection but it returns a DataView - what's the
purpose of that? The caller then casts it as a DataView in order to use it,
is't a normal approach or? And what about overhead with all that
typecasting?
Kind regards