promposive
Senior member
Which is better, and why?
edit: Wow... How do you make the "Attach Code" actually get line breaks???
//Example 1:
public Employee FindByEID(long EID)
{
foreach (Employee employee in this)
{
if (employee.EID == EID)
{
return employee;
}
}
return null;
}
//Example 2:
public Employee FindByEID(long EID)
{
Employee returnValue = null;
foreach (Employee employee in this)
{
if (employee.EID == EID)
{
returnValue = employee;
break;
}
}
return returnValue;
}
edit: Wow... How do you make the "Attach Code" actually get line breaks???
//Example 1:
public Employee FindByEID(long EID)
{
foreach (Employee employee in this)
{
if (employee.EID == EID)
{
return employee;
}
}
return null;
}
//Example 2:
public Employee FindByEID(long EID)
{
Employee returnValue = null;
foreach (Employee employee in this)
{
if (employee.EID == EID)
{
returnValue = employee;
break;
}
}
return returnValue;
}