You are an enterprise application developer. The data access layer of an application contains the following code segment. (Line numbers are included for reference only.) 01 static public List<Employee> GetEmployees(){02 List<Employee> employees = new List<Employee>();03 using
(SqlConnection cnn = new SqlConnection(_cnnStr)){04 SqlCommand cmd = new SqlCommand(“GetEmployees”, cnn);05 cnn.Open();06 DataSet ds = new DataSet();07 SqlDataAdapter
da = new SqlDataAdapter(cmd);08 da.Fill(ds);09 foreach (DataRow row in ds.Tables[0].Rows){10 Employee emp = new Employee();11 emp.ID = Convert.ToInt32(row[“Id”]);12
emp.Name = Convert.ToString(row[“Name”]); //13
employees.Add(emp);14 }15 }16 return employees;17 } You review the code segment and discover that it takes a long time to execute. You need to modify the code segment to improve the performance. What should you do?
A.
Create a SqlDataReader object.Iterate through a DataReader object to populate the employees list.
B.
Fill a DataTable object by using a DataTable.Load method.Iterate through the DataTable to populate the employees list.
C.
Fill a DataTable object by using a SqlDataAdapter object.Iterate through the DataTable to populate the employees list.
D.
Fill a DataTable object by using a DataTable.Load method.Create a DataTableReader object from the DataTable.Iterate through the DataTableReader to populate the employees list.