我读到一个变量永远不应该做超过一件事。重载一个变量来做不止一件事是不好的。因此,我最终编写了如下代码:(使用customerFound变量)boolcustomerFound=false;CustomerfoundCustomer=null;if(currentCustomer.IsLoaded){if(customerIDToFind=currentCustomer.ID){foundCustomer=currentCustomer;customerFound=true;}}else{foreach(CustomercustomerinallCustomers){if(custome
我读到一个变量永远不应该做超过一件事。重载一个变量来做不止一件事是不好的。因此,我最终编写了如下代码:(使用customerFound变量)boolcustomerFound=false;CustomerfoundCustomer=null;if(currentCustomer.IsLoaded){if(customerIDToFind=currentCustomer.ID){foundCustomer=currentCustomer;customerFound=true;}}else{foreach(CustomercustomerinallCustomers){if(custome