will DataTable within function Reduce Program Performance?
Sir, I have a doubt in datatable use in C#.
We often use the function from a class like this:-
I here writing two methods. Please go through my two methods
Method:1
public void EmployeeNameComboFill()
{
try
{
DataTable dtb= new DataTable();
EmployeeSP SpEmployee = new EmployeeSP();
dtbl = SpEmployee .EmployeeNameComboFill();
cmbName.DataSource = dtbl;
cmbName.ValueMember = "employeeId";
cmbName.DisplayMember = "employeeName";
cmbName.SelectedIndex = -1;
}
catch (Exception ex)
{
throw;
}
}
Method:2
public void EmployeeNameComboFill()
{
try
{
EmployeeSP SpEmployee = new EmployeeSP();
cmbName.DataSource=SpEmployee .EmployeeNameComboFill();
cmbName.ValueMember = "employeeId";
cmbName.DisplayMember = "employeeName";
cmbName.SelectedIndex = -1;
}
catch (Exception ex)
{
throw;
}
}
In the above functions, which one is faster or standard?